用test账号登录,然后用cd , chmod命令修改test目录的权限.
[test@localhost ~]$ ls -al
total 36
drwx------. 5 test test 4096 Jun 21 01:27 .
drwxr-xr-x. 4 root root 26 Jun 20 17:20 ..
-rw-rw-r--. 1 test test 0 Jun 20 17:43 1.txt
-rw-------. 1 test test 3095 Jun 20 20:00 .bash_history
-rw-r--r--. 1 test test 18 Mar 6 06:06 .bash_logout
-rw-r--r--. 1 test test 194 Jun 17 11:28 .bash_profile
-rw-r--r--. 1 test test 231 Mar 6 06:06 .bashrc
-rw-------. 1 test test 69 Jun 17 09:29 .lesshst
-rwxr-xr-x. 1 root root 89 Jun 15 22:16 mountshell
-rw-r--r--. 1 root root 6 Jun 17 14:11 mytestdd
drwxr-xr-x. 2 root root 6 Jun 21 01:28 shares
drwxr-xr-x. 6 root root 56 Jun 19 04:22 .vim
-rw-------. 1 test test 3476 Jun 20 17:43 .viminfo
drwxrwxr-x. 2 test test 6 Jun 20 17:43 xy
[test@localhost ~]$ chmod 766 .
[test@localhost ~]$ ls -al
total 36
drwxrw-rw-. 5 test test 4096 Jun 21 01:27 . //明显权限已经修改了
drwxr-xr-x. 4 root root 26 Jun 20 17:20 ..
-rw-rw-r--. 1 test test 0 Jun 20 17:43 1.txt
-rw-------. 1 test test 3095 Jun 20 20:00 .bash_history
-rw-r--r--. 1 test test 18 Mar 6 06:06 .bash_logout
-rw-r--r--. 1 test test 194 Jun 17 11:28 .bash_profile
-rw-r--r--. 1 test test 231 Mar 6 06:06 .bashrc
-rw-------. 1 test test 69 Jun 17 09:29 .lesshst
-rwxr-xr-x. 1 root root 89 Jun 15 22:16 mountshell
-rw-r--r--. 1 root root 6 Jun 17 14:11 mytestdd
drwxr-xr-x. 2 root root 6 Jun 21 01:28 shares
drwxr-xr-x. 6 root root 56 Jun 19 04:22 .vim
-rw-------. 1 test test 3476 Jun 20 17:43 .viminfo
drwxrwxr-x. 2 test test 6 Jun 20 17:43 xy
说明sanba这个账号有进入test目录里。
于是:
[test@localhost ~]$ su sanba
Password:
[sanba@localhost test]$ pwd
/home/test
[sanba@localhost test]$ ls -al
ls: cannot open directory .: Permission denied //why?chmod 766 . 已经生效了啊。
[sanba@localhost test]$ cd xy
bash: cd: xy: Permission denied
[sanba@localhost test]$ pwd
/home/test
[root@localhost home]# ls
sanba test
[root@localhost home]# ls -al
total 8
drwsr-sr-x. 4 root root 26 Jun 20 17:20 .
dr-xr-xr-x. 18 root root 4096 Jun 23 11:36 ..
drwx------. 2 jh test 94 Jun 20 20:00 sanba
drwxrw-rw-. 5 test test 4096 Jun 23 12:31 test