Difference between revisions of "Sudo"

From ArchWiki
Jump to navigation Jump to search
m (i18n links added)
Line 4: Line 4:
 
{{i18n_entry|English|Sudo}}
 
{{i18n_entry|English|Sudo}}
 
{{i18n_entry|Français|Sudo (Français)}}
 
{{i18n_entry|Français|Sudo (Français)}}
 +
{{i18n_entry|Русский|Sudo (Russian)}}
 
{{i18n_links_end}}
 
{{i18n_links_end}}
  

Revision as of 13:04, 2 May 2007

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

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 privileges 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

See also