{"id":13298,"date":"2019-04-01T11:43:06","date_gmt":"2019-04-01T11:43:06","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13298"},"modified":"2019-04-01T11:43:06","modified_gmt":"2019-04-01T11:43:06","slug":"how-to-run-sudo-command-without-entering-a-password-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/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":"<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\u00a0<strong>sudo<\/strong>\u00a0can become so boring in the long run. Therefore, in this guide, we will describe\u00a0<a href=\"https:\/\/www.tecmint.com\/sudoers-configurations-for-setting-sudo-in-linux\/\" target=\"_blank\" rel=\"noopener\">how to configure sudo command<\/a>\u00a0to run without entering a password.<\/p>\n<p>This setting is done in the\u00a0<strong>\/etc\/sudoers<\/strong>\u00a0file, which drives sudoers to use default security policy plugin for the\u00a0<a href=\"https:\/\/www.tecmint.com\/su-vs-sudo-and-how-to-configure-sudo-in-linux\/\" target=\"_blank\" rel=\"noopener\">sudo command<\/a>; under the user privilege specification section.<\/p>\n<p><strong>Important<\/strong>: In the\u00a0<strong>sudeors<\/strong>\u00a0file, the authenticate parameter which is turned on by default is used for authentication purposes. If it is set, users must authenticate themselves via a password (or other means of authentication) before they run commands with\u00a0<strong>sudo<\/strong>.<\/p>\n<p>However, this default value may be overridden using the\u00a0<strong>NOPASSWD<\/strong>\u00a0(require no password when user invokes\u00a0<strong>sudo<\/strong>\u00a0command) tag.<\/p>\n<p>The syntax to configure user privileges is as follows:<\/p>\n<pre>user_list host_list=effective_user_list tag_list command_list\r\n<\/pre>\n<p>Where:<\/p>\n<ol>\n<li><code>user_list<\/code>\u00a0\u2013 list of users or a user alias that has already been set.<\/li>\n<li><code>host_list<\/code>\u00a0\u2013 list of hosts or a host alias on which users can run sudo.<\/li>\n<li><code>effective_user_list<\/code>\u00a0\u2013 list of users they must be running as or a run as alias.<\/li>\n<li><code>tag_list<\/code>\u00a0\u2013 list of tags such as NOPASSWD.<\/li>\n<li><code>command_list<\/code>\u00a0\u2013 list of commands or a command alias to be run by user(s) using sudo.<\/li>\n<\/ol>\n<p>To allow a user (<code>aaronkilik<\/code>\u00a0in the example below) to run all commands using\u00a0<strong>sudo<\/strong>\u00a0without a password, open the\u00a0<strong>sudoers<\/strong>\u00a0file:<\/p>\n<pre>$ sudo visudo\r\n<\/pre>\n<p>And add the following line:<\/p>\n<pre>aaronkilik ALL=(ALL) NOPASSWD: ALL\r\n<\/pre>\n<p>For the case of a group, use the\u00a0<code>%<\/code>\u00a0character before the group name as follows; this means that all member of the\u00a0<code>sys<\/code>\u00a0group will run all commands using sudo without a password.<\/p>\n<pre>%sys ALL=(ALL) NOPASSWD: ALL\r\n<\/pre>\n<p>To permit a user to run a given command (<code>\/bin\/kill<\/code>) using sudo without a password, add the following line:<\/p>\n<pre>aaronkilik ALL=(ALL) NOPASSWD: \/bin\/kill\r\n<\/pre>\n<p>The line below will enable member of the\u00a0<code>sys<\/code>\u00a0group to run the commands:\u00a0<strong>\/bin\/kill<\/strong>,\u00a0<strong>\/bin\/rm<\/strong>\u00a0using\u00a0<strong>sudo<\/strong>without a password:<\/p>\n<pre>%sys ALL=(ALL) NOPASSWD: \/bin\/kill, \/bin\/rm\r\n<\/pre>\n<div id=\"attachment_24306\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/01\/Run-sudo-Without-Password.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24306\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/01\/Run-sudo-Without-Password.png\" sizes=\"auto, (max-width: 884px) 100vw, 884px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/01\/Run-sudo-Without-Password.png 884w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/01\/Run-sudo-Without-Password-768x426.png 768w\" alt=\"Run sudo Without Password\" width=\"884\" height=\"490\" aria-describedby=\"caption-attachment-24306\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-24306\" class=\"wp-caption-text\">Run sudo Without Password<\/p>\n<\/div>\n<p>For more\u00a0<strong>sudo<\/strong>\u00a0configuration and additional usage options, read our articles that describes more examples:<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/sudoers-configurations-for-setting-sudo-in-linux\/\" target=\"_blank\" rel=\"noopener\">10 Useful Sudoers Configurations for Setting \u2018sudo\u2019 in Linux<\/a><\/li>\n<li><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/sudo-insult-when-enter-wrong-password\/\" target=\"_blank\" rel=\"noopener\">Let Sudo Insult You When You Enter Incorrect Password<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/set-sudo-password-timeout-session-longer-linux\/\" target=\"_blank\" rel=\"noopener\">How to Keep \u2018sudo\u2019 Password Timeout Session Longer in Linux<\/a><\/li>\n<\/ol>\n<p>In this article, we described how to configure sudo command to run without entering a password. Do not forget to offer us your thoughts about this guide or other useful sudeors configurations for Linux system administrators all in the comments.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/run-sudo-command-without-password-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<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\u00a0sudo\u00a0can become so boring in the long run. Therefore, in this guide, we will describe\u00a0how to configure sudo command\u00a0to run without entering a password. This setting is done in the\u00a0\/etc\/sudoers\u00a0file, which &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-run-sudo-command-without-entering-a-password-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Run \u2018sudo\u2019 Command Without Entering a Password in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13298","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13298"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13298\/revisions"}],"predecessor-version":[{"id":13299,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13298\/revisions\/13299"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}