Linux 命令笔记(1)

[[email protected]_2 ~]# ll
total 268
-rw-------. 1 root root   1090 May  3 09:35 anaconda-ks.cfg
drwxr-xr-x. 3 root root   4096 May 21 16:24 backup
drwxr-xr-x  2 root root   4096 May 22 12:24 Desktop
drwxr-xr-x  2 root root   4096 May 22 12:24 Documents
drwxr-xr-x  2 root root   4096 May 22 12:24 Downloads
-rw-r--r--. 1 root root   8823 May  3 09:35 install.log
-rw-r--r--. 1 root root   3384 May  3 09:34 install.log.syslog
drwxr-xr-x  2 root root   4096 May 22 12:24 Music
-rw-r--r--  1 root root 210877 Aug 22  2012 pdksh-5.2.14-37.el5_8.1.x86_64.rpm
drwxr-xr-x  2 root root   4096 May 22 12:24 Pictures
drwxr-xr-x  2 root root   4096 May 22 12:24 Public
drwxr-xr-x. 2 root root   4096 May  4 10:17 scripts
drwxr-xr-x  2 root root   4096 May 22 12:24 Templates
drwxr-xr-x  2 root root   4096 May 22 12:24 Videos

用户读取目录的权限应该是5(r-x) 而不是 4(r--) ,x意味着有在目录下执行命令的权限。
[[email protected]_2 ~]# useradd backup
[[email protected]_2 ~]# useradd jingy
[[email protected]_2 ~]# su - backup
[[email protected]_2 ~]$ id
uid=501(backup) gid=503(backup) groups=503(backup)
[[email protected]_2 ~]$ exit
logout
[[email protected]_2 ~]# su - jingy
[[email protected]_2 ~]$ id
uid=502(jingy) gid=504(jingy) groups=504(jingy)
[[email protected]_2 ~]$ exit
logout
[[email protected]_2 ~]# usermod -a -G backup jingy
[[email protected]_2 ~]# su - jingy
[[email protected]_2 ~]$ id
uid=502(jiongy) gid=504(jingy) groups=504(jingy),503(backup)
[[email protected]_2 ~]$ id
uid=502(jiongy) gid=504(jingy) groups=504(jingy),503(backup)

usermod -G backup jingy #修改用户次要组信息usermod -a -G backup jingy #将用户添加到新的次要组中
时间: 06-02