+ -
当前位置:首页 → 问答吧 → (求)sudo的具体配置 和 安装过程?????

(求)sudo的具体配置 和 安装过程?????

时间:2010-04-28

来源:互联网

~~~~~~~~~~~~~~

作者: liufangzhaoly   发布时间: 2010-04-28

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.

作者: vimtex   发布时间: 2010-04-28

热门下载

更多