Linux 命令笔记(1)

[root@Oracle11_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意味着有在目录下执行命令的权限。
[root@Oracle11_2 ~]# useradd backup
[root@Oracle11_2 ~]# useradd jingy
[root@Oracle11_2 ~]# su - backup
[backup@Oracle11_2 ~]$ id
uid=501(backup) gid=503(backup) groups=503(backup)
[backup@Oracle11_2 ~]$ exit
logout
[root@Oracle11_2 ~]# su - jingy
[jiongy@Oracle11_2 ~]$ id
uid=502(jingy) gid=504(jingy) groups=504(jingy)
[jiongy@Oracle11_2 ~]$ exit
logout
[root@Oracle11_2 ~]# usermod -a -G backup jingy
[root@Oracle11_2 ~]# su - jingy
[jiongy@Oracle11_2 ~]$ id
uid=502(jiongy) gid=504(jingy) groups=504(jingy),503(backup)
[jiongy@Oracle11_2 ~]$ id
uid=502(jiongy) gid=504(jingy) groups=504(jingy),503(backup)

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

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。