Quantcast
Channel: Java mon amour
Viewing all articles
Browse latest Browse all 1121

sudoers file syntax (sudo by example)

$
0
0
Here the official (?) doc for sudoers and sudo. Particularly important in the sudoers file format, with the User_Alias Runas_Alias Host_Alias Cmnd_Alias story. It's very important to read all the options, since it's very versatile and allows you to get well organized if you know them.

A simple example here: how to give all root privileges to user vagrant:

Login as root
visudo
append this:

vagrant ALL=(ALL) ALL
exit visudo with :wq
sudo su - vagrant
cat /etc/sudoers

cat: /etc/sudoers: Permission denied (of course, vagrant user cannot see the /etc/sudoers file which is only read for root)

sudo cat /etc/sudoers

this one works, because it's being executed as the root user !

Hint: you can also use visudo -f /etc/sudoers.d/filename


Viewing all articles
Browse latest Browse all 1121

Trending Articles