I'm pulling my hair out over this thing.
Using Raspberian here.
So I'm trying to restrict the Pi user from being able to use sudo
without the root password. After heavy searching, I gave up on that, and now I'm trying to just disable all access to sudo
. I can always just su -
when needed, after all.
My current /etc/sudoers file looks like
#
# 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 mail_badpass
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
# 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
Throughout my searches, I mostly found awnsers of removing or changing the Pi user's entry in the file. On my install, there never was an entry for Pi user, and it seems the permissions were instead inherited from the sudo group.
I've since commented out the sudo group from /etc/sudoers, and also removed the Pi user from said group.
pi@raspberrypi:~ $ groups pi
pi : pi adm dialout cdrom audio video plugdev games users input netdev spi i2c gpio
But still;
pi@raspberrypi:~ $ sudo -l
Matching Defaults entries for pi on raspberrypi:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User pi may run the following commands on raspberrypi:
(ALL) NOPASSWD: ALL
And displaying the issue;
pi@raspberrypi:~ $ ls /root/
ls: cannot open directory /root/: Permission denied
pi@raspberrypi:~ $ sudo ls /root/
Desktop Documents Downloads Music Pictures Public temp Templates Videos
How do I either require the root password for sudo
, or just remove the Pi's access to it, if not through visudo
?
root
password (you can create one, but that is inadvisable, which is why Debian doesn't have one). Why do you want thepi
user (who is a system Administrator) to be unable to do anything on the system? If you need restricted users, create them! – Milliways Nov 20 '16 at 05:44