This question already has an answer here:
I'm trying to set my local computer (which has Linux Mint 13 Maya) so that I can
chown any file with my regular
max user account.
I've done the following:
#edit the /etc/sudoers file via `visudo` sudo visudo #in the file, added these lines: Cmnd_Alias NOPASS_CMNDS = /bin/chmod, /bin/chown max ALL=(ALL) NOPASSWD: NOPASS_CMNDS
Then saved. (I got the locations for chmod and chown using
visudo file now looks like this:
# # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL Cmnd_Alias NOPASS_CMNDS = /bin/chmod, /bin/chown max ALL=(ALL) NOPASSWD: NOPASS_CMNDS # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d
This is the output from
$ sudo -l Matching 'Defaults' entries for max on this host: env_reset, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin User max may run the following commands on this host: (ALL) NOPASSWD: /bin/chmod, /bin/chown (ALL : ALL) ALL
I then open a new shell tab and try to
sudo chmod a file which is owned by a different user & group, and it asks me for a password:
$ ls -l tmp/0000000001 -rw------- 1 www-data www-data 19245781 Sep 10 16:59 tmp/0000000001 $ sudo chmod +w tmp/0000000001 [sudo] password for max:
Am I missing something here? I don't know if I've done it wrong or have misunderstood what I was actually trying to change.
Do I need to reboot, or reload/restart something to see the change?