Debian普通用户能够sudo的办法

  su进入超级用户(root), 然后运行 visudo, 一定使用visudo命令来编辑,不然会提示如下错误:

    “sudo: 没有找到有效的 sudoers 资源,退出

     sudo: 无法初始化策略插件 ”

 

  visudo默认打开/etc/sudoers文件进行编辑, 调用的nano编辑。

  如下, 将XX处改为你的普通用户, Ctrl+O写入文件, Ctrl+X退出即可:

 

 1 root@bb-debian:/home/bb# cat /etc/sudoers
 2 #
 3 # This file MUST be edited with the 'visudo' command as root.
 4 #
 5 # Please consider adding local content in /etc/sudoers.d/ instead of
 6 # directly modifying this file.
 7 #
 8 # See the man page for details on how to write a sudoers file.
 9 #
10 Defaults    env_reset
11 Defaults    mail_badpass
12 Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
13 
14 # Host alias specification
15 
16 # User alias specification
17 
18 # Cmnd alias specification
19 
20 # User privilege specification
21 root    ALL=(ALL:ALL) ALL
22 XX   ALL=(ALL:ALL) ALL
23 
24 # Allow members of group sudo to execute any command
25 %sudo    ALL=(ALL:ALL) ALL
26 
27 # See sudoers(5) for more information on "#include" directives:
28 
29 #includedir /etc/sudoers.d

 

posted @ 2015-07-23 23:11  virqin  阅读(446)  评论(0编辑  收藏  举报