{"id":5379,"date":"2026-07-06T16:23:32","date_gmt":"2026-07-06T16:23:32","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=5379"},"modified":"2026-07-06T16:23:33","modified_gmt":"2026-07-06T16:23:33","slug":"sudoers-nopasswd-option-not-working","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=5379","title":{"rendered":"Sudoers NOPASSWD Option Not Working"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Although not good security practice, it can be helpful for a user to account to have at least some (or all) sudo ability without the need to re-enter the user&#8217;s password to gain sudoers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By adding the user within the file \/etc\/sudoers (via visudo is recommended for Ubuntu Linux), with the following, you can ensure a user can sudo without re-entering their password. For example for Ansible plays is a good example.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>myuseraccount ALL=(ALL) NOPASSWD: ALL<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">What is important is where in the file you are entering this. You should put that line after the line with the rule for the sudo group, because, as the sudoers man page states:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>When multiple entries match for a user, they are applied in order.\nWhere there are multiple matches, the last match is used (which is not necessarily the most specific match).<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So just add it at the bottom and you should find it works as expected.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although not good security practice, it can be helpful for a user to account to have at least some (or all) sudo ability without the need to re-enter the user&#8217;s password to gain sudoers. By adding the user within the file \/etc\/sudoers (via visudo is recommended for Ubuntu Linux), with the following, you can ensure &#8230; <a title=\"Sudoers NOPASSWD Option Not Working\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=5379\" aria-label=\"Read more about Sudoers NOPASSWD Option Not Working\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4282,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-5379","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/5379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5379"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/5379\/revisions"}],"predecessor-version":[{"id":5380,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/5379\/revisions\/5380"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4282"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}