分类: LINUX
2013-06-19 09:17:20
1、一般用户赋权设置:
[root@localhost ~]# visudo ……前面省略 69 ## Syntax: 70 ## 71 ## user MACHINE=COMMANDS 72 ## 73 ## The COMMANDS section may have other options added to it. 74 ## 75 ## Allow root to run any commands anywhere 76 root ALL=(ALL) ALL 77 test ALL=(root) /usr/sbin/useradd //新增加用户行……后面省略 |
[root@server ~]# su - redhat [redhat@server ~]$ sudo /usr/sbin/useradd test //命令需要输入完整的路径 口令: //这里输入用户redhat自己的密码 [redhat@server ~]$ cat /etc/passwd |tail -5 xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin gdm:x:42:42::/var/gdm:/sbin/nologin sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin redhat:x:500:500::/home/redhat:/bin/bash test:x:501:501::/home/test:/bin/bash //新增加的用户 |
[root@localhost ~]# visudo ……前面省略 16 ## User Aliases 17 ## These aren't often necessary, as you can use regular groups 18 ## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname 19 ## rather than USERALIAS 20 # User_Alias ADMINS = jsmith, mikem //这个就是一个实例行,按照这个写自己的 21 User_Alisa sudouser=user1,user2,user3,user4 //第一一个别名suduouser ……后面省略 69 ## Syntax: 70 ## 71 ## user MACHINE=COMMANDS 72 ## 73 ## The COMMANDS section may have other options added to it. 74 ## 75 ## Allow root to run any commands anywhere 76 root ALL=(ALL) ALL 77 sudouser ALL=(root) /usr/sbin/useradd ////命令行书写格式,用户列用别名……后面省略 |
[root@localhost ~]# visudo ……前面省略 23 ## Command Aliases 24 ## These are groups of related commands... 25 26 ## Networking 27 Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dh client, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool //多个命令定义一个命令别名; ……后面省略 69 ## Syntax: 70 ## 71 ## user MACHINE=COMMANDS 72 ## 73 ## The COMMANDS section may have other options added to it. 74 ## 75 ## Allow root to run any commands anywhere 76 root ALL=(ALL) ALL 77 sudouser ALL=(root) NETWORKING //命令行书写格式,命令列用别名……后面省略 |
[root@localhost ~]# visudo ……前面省略 81 82## Allows people in group wheel to run all commands 83# %wheel ALL=(ALL) ALL //用户列%+群组名 ……后面省略 |