Difference between revisions of "sudo"
From wiki
(Basic configure) |
m (typo) |
||
Line 16: | Line 16: | ||
Some Linux distributions (Ubuntu, Raspbian…) come with <code>sudo</code> preconfigured and no password for the root user. This pose a risk of locking you out in case you break <code>sudo</code>. | Some Linux distributions (Ubuntu, Raspbian…) come with <code>sudo</code> preconfigured and no password for the root user. This pose a risk of locking you out in case you break <code>sudo</code>. | ||
− | If you are not confident, you can add a password to the root user before edition to be sure to have a second way to gain root | + | If you are not confident, you can add a password to the root user before edition to be sure to have a second way to gain root access<syntaxhighlight lang="console"> |
$ sudo passwd | $ sudo passwd | ||
Enter new UNIX password: | Enter new UNIX password: |
Latest revision as of 22:29, 27 February 2017
Install
sudo
is probably pre-installed with your system. To test it, run
$ sudo -l
Matching Defaults entries for arthur on deepthought:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, insults, env_keep+="SSH_CLIENT SSH_CONNECTION SSH_TTY", env_keep+=COLORFGBG, passwd_timeout=5
User arthur may run the following commands on deepthought:
(ALL : ALL) ALL
In case it is not installed, you can install it using
$ su -c "apt install sudo"
Configure
Backup root Access
Some Linux distributions (Ubuntu, Raspbian…) come with sudo
preconfigured and no password for the root user. This pose a risk of locking you out in case you break sudo
.
If you are not confident, you can add a password to the root user before edition to be sure to have a second way to gain root access
$ sudo passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
# su
Password:
# exit
Editing
$ sudo visudo
// or
$ su -c visudo
Remove root Password
Once you are done configuring sudo
, you might decide to disable the root account (the is the default state on Ubuntu). This will leave you with sudo
for all tasks requiring the root account.
$ sudo passwd -dl root