{"id":1356,"date":"2019-01-28T08:20:57","date_gmt":"2019-01-28T02:50:57","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1356"},"modified":"2019-02-25T06:55:23","modified_gmt":"2019-02-25T01:25:23","slug":"how-to-run-sudo-command-without-entering-a-password-in-linux","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/how-to-run-sudo-command-without-entering-a-password-in-linux\/","title":{"rendered":"How to Run \u2018sudo\u2019 Command Without Entering a Password in Linux"},"content":{"rendered":"\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Description <\/strong><\/p>\n\n\n\n<p>In case you are running Linux on a machine that you normally use alone, say on a laptop, entering a password each time you invoke sudo can become so boring in the long run. <\/p>\n\n\n\n<p>Therefore, in this guide, we will describe how to configure sudo command to run without entering a password.<\/p>\n\n\n\n<p>This setting is done in the \/etc\/sudoers file, which drives sudoers to use default security policy plugin for the sudo command; under the user privilege specification section.<\/p>\n\n\n\n<p>Important: In the sudeors file, the authenticate parameter which is turned on by default is used for authentication purposes. <\/p>\n\n\n\n<p>If it is set, users must authenticate themselves via a password (or other means of authentication) before they run commands with sudo.<\/p>\n\n\n\n<p>However, this default value may be overridden using the NOPASSWD (require no password when user invokes sudo command) tag.<\/p>\n\n\n\n<p>The syntax to configure user privileges is as follows:<\/p>\n\n\n\n<p><strong><em>user_list host_list=effective_user_list tag_list command_list<\/em><\/strong><\/p>\n\n\n\n<p>Where:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>user_list \u2013 list of users or a user alias that has already been set.<\/li><li> host_list \u2013 list of hosts or a host alias on which users can run sudo.<\/li><li> effective_user_list \u2013 list of users they must be running as or a run as alias.<\/li><li> tag_list \u2013 list of tags such as NOPASSWD.<\/li><li> command_list \u2013 list of commands or a command alias to be run by user(s) using sudo.<\/li><\/ul>\n\n\n\n<p>To allow a user (username in the example below) to run all commands using sudo without a password, open the sudoers file:<\/p>\n\n\n\n<p><strong><em>$ sudo visudo<\/em><\/strong><\/p>\n\n\n\n<p>And add the following line:<\/p>\n\n\n\n<p><strong><em>username ALL=(ALL) NOPASSWD: ALL<\/em><\/strong><\/p>\n\n\n\n<p>For the case of a group, use the % character before the group name as follows; this means that all member of the sys group will run all commands using sudo without a password.<\/p>\n\n\n\n<p><strong><em>%sys ALL=(ALL) NOPASSWD: ALL<\/em><\/strong><\/p>\n\n\n\n<p>To permit a user to run a given command (\/bin\/kill) using sudo without a password, add the following line:<\/p>\n\n\n\n<p><strong><em>username ALL=(ALL) NOPASSWD: \/bin\/kill<\/em><\/strong><\/p>\n\n\n\n<p>The line below will enable member of the sys group to run the commands: \/bin\/kill, \/bin\/rm using sudo without a password:<\/p>\n\n\n\n<p><strong><em>%sys ALL=(ALL) NOPASSWD: \/bin\/kill, \/bin\/rm<\/em><\/strong><\/p>\n\n\n\n<p>We hope you\u2019ve found this useful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description In case you are running Linux on a machine that you normally use alone, say on a laptop, entering a password each time you invoke sudo can become so boring in the long run. Therefore, in this guide, we will describe how to configure sudo command to run without entering a password. This setting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1357,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-categorized"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1356"}],"version-history":[{"count":3,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1356\/revisions"}],"predecessor-version":[{"id":1380,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1356\/revisions\/1380"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1357"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}