Wednesday, 27 May 2009

Sudo setup

To use sudo setup users and groups using normal Linux then use the visudo command to edit the configuration file.

To allow members of the group to run any command as themselves:
%groupname ALL= ALL
To allow members of the group to run any command as any user with the exception of /usr/su:
%groupname ALL=(ALL) ALL, !/usr/su
Now prepend any command with sudo and it will run as root. If you forget you can rerun the last command with !! eg:
# visudo
Error, permission denied
# sudo !!
runs visudo as root

To run a command as a specific user:
# sudo -u <username> <command>

No comments:

Post a Comment