|
发表于 2010-4-28 10:31:53
|
显示全部楼层
http://wiki.archlinux.org/index.php/Sudo
Installation
To install sudo:
# pacman -S sudo
By default, users will not be allowed to run sudo. See #Configuration for instructions.
Usage
With sudo installed and configured, users are able to prefix commands with sudo to run said command with superuser (or other) privileges. For example:
$ sudo pacman -Syu
See the sudo manual for more information.
Configuration
The configuration file for sudo is /etc/sudoers. This file should not be edited directly! Instead, users must run the command visudo as root, which opens a temporary copy of the configuration file in $EDITOR. (If uncomfortable with vi (default), try the command export EDITOR=nano first.)
# visudo
When the file is saved, visudo will double-check the file for syntax errors before overwriting the existing /etc/sudoers file. This safety feature exists because sudo will be rendered unusable if the configuration file contains errors.
To allow a user to gain full root privileges when he/she precedes a command with "sudo", add the following line:
USER_NAME ALL=(ALL) ALL
Allow a user sudo access from the local machine only:
USER_NAME HOSTNAME=(ALL) ALL
Allow members of group wheel sudo access requiring no password:
%wheel ALL=(ALL) NOPASSWD: ALL
where USER_NAME is the user name of the individual.
A detailed sudoers example can be found here. Otherwise, see the sudoers manual for detailed information.
Password timeout
Users may wish to change the default timeout before the password expires. This is accomplished by adding following to /etc/sudoers (visudo) for example:
Defaults:USER_NAME timestamp_timeout=20
where the password expires for user USER_NAME if unused for over 20 minutes. |
|