分类: LINUX
2015-01-16 22:10:06
1 2 | [root@rhel1 xcg]# uname -a Linux rhel1.kongzhong.com 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux |
1 2 3 4 5 6 | [root@rhel1 ~]# useradd xcg [root@rhel1 ~]# passwd xcg Changing password foruser xcg. New password: Retype new password: passwd: all authentication tokens updated successfully. |
1 2 3 4 5 6 7 | [root@rhel1 ~]# cd /etc/ [root@rhel1 etc]# ll sudoers -r--r-----. 1 root root 4002 Mar 2 2012 sudoers [root@rhel1 etc]# chmod 755 sudoers [root@rhel1 etc]# ll sudoers -rwxr-xr-x. 1 root root 4002 Mar 2 2012 sudoers [root@rhel1 etc]# chmod 440 sudoers # 此步,在修改好/etc/sudoers里面的内容后,将权限还原 |
1 2 3 4 | [root@rhel1 ~]# vim /etc/sudoers root ALL=(ALL) ALL xcg ALL=(ALL) ALL # 这个在切换时,是需要输入密码的,密码是当前普通用户的密码 kongzhong ALL=(ALL) NOPASSWD:ALL # 这个在切换时,不需要输入密码 |
1 2 3 4 | [root@rhel1 ~]# vim /etc/sudoers %wheel ALL=(ALL) ALL 然后,修改普通用户,使其属于wheel 组,命令如下: [root@rhel1 etc]# usermod -g wheel kongzhong1 |
1 2 3 4 | [root@rhel1 ~]# vim /etc/passwd kongzhong2:x:504:504:kongzhong2:/home/kongzhong2:/bin/bash 修改后如下 kongzhong2:x:0:500:kongzhong2:/home/kongzhong2:/bin/bash |