/etc/sudoers
Column 1: user or %group
Column 2: host
Column 3: user executed as
Column 4: comma separated list of commands or ALL
Allow user1 to run anything as user2
user1 ALL=(user2) ALL
allow sudo su - without passwd
ALL = NOPASSWD: /usr/bin/su *
allow sudo su - without password using command aliases
Cmnd_Alias SU_CMD = /usr/bin/su , /usr/bin/su -
%group ALL = NOPASSWD: SU_CMD
become user2
sudo -u user2 bash
Allow user1 to run command as root
user1 ALL = /my/command
Allow user to run everything as root without password.
user1 ALL =(ALL) NOPASSWD: ALL
if doesn't work put at end of file