LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 851|回复: 5

大家看看我的sudoers哪有错啊

[复制链接]
发表于 2004-12-28 09:37:56 | 显示全部楼层 |阅读模式
1 # /etc/sudoers
      2 #
      3 # This file MUST be edited with the 'visudo' command as root.
      4 #
      5 # See the man page for details on how to write a sudoers file.
      6 #
      7
      8 # Host alias specification
      9 Host_Alias local=debian-scil
     10 Host_Alias whole=debian-scil,sun,luan
     11
     12 # User alias specification
     13 User_Alias scil=scil
     14
     15 # Cmnd alias specification
     16 Cmnd_Alias common=/sbin/halt,/sbin/reboot,/sbin/shutdown
     17 # User privilege specification
     18 root    ALL=(ALL) ALL
     19 scil    local=(scil)common



这是错误信息:
scil@debian-scil:~$ sudo /sbin/reboot
>>> sudoers file: syntax error, line 8 <<<
>>> sudoers file: syntax error, line 9 <<<
>>> sudoers file: syntax error, line 12 <<<
>>> sudoers file: syntax error, line 15 <<<
>>> sudoers file: syntax error, line 18 <<<

我是按照一本叫做<linux系统管理技术性手册>做的
本来 在论坛搜了搜
可是没找到范例
大家帮帮忙啊
发表于 2004-12-28 13:34:38 | 显示全部楼层
local、whole、common、 scil local,等号前面的变量都换成大写并且句首要顶格
 楼主| 发表于 2004-12-29 07:50:46 | 显示全部楼层
可是好像还是不行啊
scil@debian-scil:~$ sudo /sbin/reboot

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Password:
scil is not allowed to run sudo on localhost.  This incident will be reported.


现在我的文件是这样的
# Host alias specification
Host_Alias LOCAL=debian-scil
Host_Alias WHOLE=debian-scil,sun,luan

# User alias specification
User_Alias SCIL=scil

# Cmnd alias specification
Cmnd_Alias COMMON=/sbin/halt,/sbin/reboot,/sbin/shutdown
# User privilege specification
root ALL=(ALL) ALL
scil LOCAL=(SCIL)COMMON
发表于 2004-12-29 13:45:56 | 显示全部楼层
用sudo -l 查看当前用户是否有权限
用sudo /sbin/reboot
如果要密码输入当前用户密码

当前计算机名是否为local
发表于 2004-12-29 16:24:44 | 显示全部楼层
scil LOCAL=(SCIL)COMMON 最后一句还有一个小写,应该是

SCIL LOCAL=(scil)COMMON  #这里最好变成SCIL LOCAL=COMMON

你现在保存是不是不会提示错误了

用sudo -l 查看当前用户是否有权限
用sudo /sbin/reboot
 楼主| 发表于 2004-12-29 18:13:43 | 显示全部楼层
谢谢
搞定了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表