8 Ways To Tweak and Configure Sudo On Ubuntu
8 Ways To Tweak and Configure Sudo On Ubuntu
howtogeek.com
sudo –k
sudo visudo
Add the following line below the other Defaults lines in the file:
Defaults timestamp_timeout=0
Press Ctrl+O to save the file, and then press Ctrl+X to close
Nano. Sudo will now always prompt you for a password.
Defaults timestamp_timeout=5
You can also have sudo never ask for a password – as long as
you’re logged in, every command you prefix with sudo will run
with root permissions. To do this, add the following line to your
sudoers file, where username is your username:
You can also change the %sudo line – that is, the line that
allows all users in the sudo group (also known as
Administrator users) to use sudo – to have all Administrator
users not require passwords:
You can also specify specific commands that will never require
a password when run with sudo. Instead of using “ALL” after
NOPASSWD above, specify the location of the commands.
For example, the following line will allow your user account to
standarduser ALL=/usr/bin/apt-get,/sbin/shutdown
sudo -U standarduser –l
You can log all sudo access by adding the following line.
Defaults logfile=/var/log/sudo
View the contents of the log file with a command like this one: