From wiki
Revision as of 22:29, 27 February 2017 by Vincent (talk | contribs) (typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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"


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
# exit


$ 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