| [root@bogon ~]# useradd cent 添加用户 [root@bogon ~]# passwd cent 设置密码一样 [root@bogon ~]# vi /etc/group 编辑cent为wheel组 wheel:x:10:root,cent [root@bogon ~]# vi /etc/pam.d/su 编辑只能wheel组的用户能使用su命令 auth required pam_wheel.so use_uid [root@bogon ~]# vi /etc/aliases root:cen |
| [root@bogon ~]# vi /etc/sudoers root ALL=(ALL) ALL # Uncomment to allow people in group wheel to run all commands %wheel ALL=(ALL) ALL 添加wheel组能使用sudo命令 # Same thing without a password %wheel ALL=(ALL) NOPASSWD: ALL 下面自定义一些权限控制 比如控制所有用户除了root都不能执行 关机 重启命令 Cmnd_Alias SHUTDOWN = /sbin/halt, /sbin/shutdown, /sbin/poweroff, /sbin/reboot, /sbin/init # add ( commands in aliase "SHUTDOWN" are not allowed ) cent ALL=(ALL) ALL,!SHUTDOWN 不能执行关机命令 |
| ################################################# # # sudoers file. # # This file MUST be edited with the "visudo" command as root. # # See the sudoers man page for the details on how to write a sudoers file. # # Host alias specification # User alias specification # Cmnd alias specification # Defaults specification # User privilege specification root ALL=(ALL) ALL # Uncomment to allow people in group wheel to run all commands # %wheel ALL=(ALL) ALL # Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL # Samples # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom # %users localhost=/sbin/shutdown -h now ################################################## |
|
|
|