悲剧,绝对的悲剧,悲剧中的悲剧。
分类:
2011-03-15 15:58:22
|
|
daemon:x:1:1::/: bin:x:2:2::/usr/bin: sys:x:3:3::/: adm:x:4:4:Admin:/var/adm: nobody:x:60001:60001:NFS Anonymous Access User:/: noaccess:x:60002:60002:No Access User:/: nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/: |
daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin rpm:x:37:37::/var/lib/rpm:/sbin/nologin haldaemon:x:68:68:HAL daemon:/:/sbin/nologin |
… mac::300:300:mac:/home/mac:/bin/bash 密码为空 300:300是uid与gid gid必须与/etc/group下的gid匹配 也可以自己设一个group ip,这就要求修改/etc/group |
mac:x:300 手工增加一个group id |
此时home目录属族为root |
|
Red Hat Enterprise Linux AS release 4 (Nahant Update 4) Kernel 2.6.9-42.EL on an i686 login: mac Last login: Thu Jun -bash-3.00$ cat /etc/passwd |
login: macg Password: Last login: Mon Jun 18 13:59:59 from 10.4.3.119 No directory /home/macg! Logging in with home = "/". -bash: /home/macg/.bash_profile: Permission denied |
分析: -bash-2.05b$ cd home -bash-2.05b$ cd macg -bash: cd: guan: Permission denied |
-bash-2.05b$ su Password: [root@mail home]# ls -l total 95644 drwx------ drwx------ [root@mail home]# chown macg:macg macg [root@mail home]# ls -l total 95644 drwx------ drwx------ login: macg Password: Last login: Mon Jun 18 16:10:49 from 10.4.3.119 [guan@mail macg]$ |
$su 口令: # vi /etc/passwd 删除掉mysql 一行 |
# useradd mysql UX: useradd: ERROR: Inconsistent password files. |
# vi /etc/shadow 删掉mysql一行 # useradd mysql # |
/etc/passwd 和/etc/shadow不同步,建议以后删除用户一定要用userdel |
vi /etc/passwd mac::100:100:mac:/home/mac:/bin/bash macg:x:500:500::/home/macg:/bin/bash |
Red Hat Enterprise Linux AS release 4 (Nahant Update 4) Kernel 2.6.9-42.EL on an i686 login: mac Last login: Thu Jun -bash-3.00$ |
[root@old145 /]# /usr/sbin/useradd macguan |
[root@old145 mac]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash mac:x:500:500::/home/mac:/bin/bash macguan:x:501:501::/home/macguan:/bin/bash |
login: macguan Password: Login incorrect |
[root@old145 mac]# passwd -d
macguan Removing password for user macguan. passwd: Success |
Red Hat Enterprise Linux AS release 4 (Nahant Update 4) Kernel 2.6.9-42.EL on an i686 login: macguan (不是密码为空或回车,而是根本不提示输入密码) [macguan@old145 ~]$ |
login: macguan Last login: Thu Jul 24 10:18:37 from 10.4.3.119 |
[macguan@old145 ~]$ cat /etc/passwd gdm:x:42:42::/var/gdm:/sbin/nologin mac:x:500:500::/home/mac:/bin/bash macguan:x:501:501::/home/macguan:/bin/bash |
[root@old145 macguan]# cat /etc/shadow root:$1$D2eFB/9M$rTQQRIuZP0gQWxWRTVL9K.:13937:0:99999:7::: mac:$1$g9xW8J3E$Bm7WgQiY7Z9sQ7xivj6qK1:13937:0:99999:7::: macguan::14082:0:99999:7::: |
[root@xin_fc etc]# chmod 511 /usr/bin/passwd |