Sudo

From ArchWiki
Revision as of 20:31, 7 September 2006 by BrentC (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installation

To install Sudo:

pacman -S sudo

Enabling sudo for Users

To add a user as a sudo user (a "sudoer"), edit /etc/sudoers. To give the user full root privelages when he/she precedes a command with "sudo", add the following line:

USER_NAME   ALL=(ALL) ALL

where USER_NAME is the username of the individual.


Enabling Tab-Completion for sudo Users

Tab-completion, by default, will not work when a user is initially added to the sudoers file. For example, normally johndoe only has to type:

fir<TAB>

and the shell will complete out the command for him as:

firefox


If, however, johndoe is added to the sudoers file and he types:

sudo fir<TAB>

the shell will do nothing.




To ensure that tab completion for binary executables (such as firefox) are retained when sudo is used, add the following line to /home/USER_NAME/.bashrc:

complete -c sudo


To ensure that tab completion for regular files (such as /etc/X11/xorg.conf) are retained when sudo is used, add the following line to /home/USER_NAME/.bashrc:

complete -f sudo

Summary

To summarize, the following setup will satisfy most individuals, where USER_NAME is the individual's username:

1. pacman -S sudo
2. add "USER_NAME   ALL=(ALL) ALL" to /etc/sudoers
3. add "complete -cf sudo" to /home/USER_NAME/.bashrc