- 论坛徽章:
- 0
|
回复 9# L_kernel
先谢谢了,不过还有点问题哟!
其它 root 命令运行不了,输入密码都不行了:- cp@debian:~$ sudo cat /etc/sudoers
- Sorry, user cp is not allowed to execute '/bin/cat /etc/sudoers' as root on debian.
- cp@debian:~$ sudo visudo
- Sorry, user cp is not allowed to execute '/usr/sbin/visudo' as root on debian.
- cp@debian:~$ sudo visudo
- Sorry, user cp is not allowed to execute '/usr/sbin/visudo' as root on debian.
- cp@debian:~$ sudo fdisk -l
- Sorry, user cp is not allowed to execute '/sbin/fdisk -l' as root on debian.
- cp@debian:~$ sudo ifconfig
- eth0 Link encap:Ethernet HWaddr 00:1f:16:12:ec:02
- inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
- inet6 addr: fe80::21f:16ff:fe12:ec02/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:1533 errors:0 dropped:0 overruns:0 frame:0
- TX packets:1821 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:100
- RX bytes:674051 (658.2 KiB) TX bytes:396901 (387.5 KiB)
- Memory:f2600000-f2620000
- lo Link encap:Local Loopback
- inet addr:127.0.0.1 Mask:255.0.0.0
- inet6 addr: ::1/128 Scope:Host
- UP LOOPBACK RUNNING MTU:16436 Metric:1
- RX packets:10 errors:0 dropped:0 overruns:0 frame:0
- TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:660 (660.0 B) TX bytes:660 (660.0 B)
- cp@debian:~$
复制代码- cp@debian:~$ su - root
- 密码:
- root@debian:~# egrep -v '^#|^$^' /etc/sudoers
- Defaults env_reset
- root ALL=(ALL) ALL
- cp ALL=NOPASSWD: /sbin/ifconfig,/sbin/reboot,/sbin/halt,/sbin/shutdown
- %sudo ALL=(ALL) ALL
- root@debian:~#
复制代码 我加了个 root 命令中的 ifconfig 命令在里面(用来测试吧),这样确实可以不用密码就能执行 ifconfig 这类 root 的命令;但是其它的 root 命令用不了了(例: sudo visudo 和 sudo fdisk -l 这类也是 root 的命令,就执行不行了)
在你那里可以不,在我这里不行了 {:3_199:} |
|