The /etc/sudoers file contains the set of UNIX operating-system privileges that the local administrator has granted to UNIX users.
In no case should this file be edited directly with vi; it must be edited with visudo.
1sudo : execute a command as root.
2sudo su : become root and stay root.
3sudoers : file listing the commands allowed for certain users as the superuser (or another user).
4visudo -cs : strict syntax check of the sudoers file.
sudo -i is equivalent to su - in terms of rights.sudo -i, the user password is asked.su -, the root password is asked.1sudo -l -U <user>
1# "user" runs "sudo -u target All_the_commands"
2user server=(target) NOPASSWD: ALL
1Host_Alias LOAD_BALANCERS = server1,server2
2
3Cmnd_Alias SET_VIP = \
4/sbin/ip addr add 192.168.10.12/20 broadcast 192.168.15.255 dev eth0 label eth0\:0, \
5/sbin/ip addr del 192.168.10.12/20 dev eth0, \
6/sbin/arping -U -c 1 -I eth0 192.168.10.12
7
8loaduser LOAD_BALANCERS=(root) NOPASSWD: SET_VIP
9syncuser LOAD_BALANCERS=(root) NOPASSWD: SET_VIP