您的位置:首页 > 其它

ubuntu使用sudo时不用输入密码

2016-11-20 01:26 573 查看
查看/etc/sudoers

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d


该文件的权限为

-r--r----- 1 root root 745 Feb 11  2014 /etc/sudoers


所以通常不建议直接修改该文件

/etc/sudoers文件最后包含了一个目录/etc/sudoers.d

只需要将用户设置在该目录内的一个文件中即可

文件不要以~结尾或包含点.

使用命令sudo visudo -f /etc/sudoers.d/users增加文件

并在文件中添加

user ALL= NOPASSWD: ALL
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ubuntu