Home Linux Authentication

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

<user1> ALL = NOPASSWD: /usr/bin/su *<user2>

allow sudo su - without password using command aliases

Cmnd_Alias     SU_CMD = /usr/bin/su <username>, /usr/bin/su - <username>
%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.


if doesn't work put at end of file