linux文件夹拥有者是否有权限对文件夹内所有文件进行读写
步骤:
1,用我个人账号在机器上mkdir 一个目录 tmp
2,su 切换root 用户,在tmp内创建一个文件test
3,切换回个人账号,进入tmp 打开test,进行写,结果是文件可以被修改。
问题:
test文件的拥有者是root,权限是
-rw-r--r-- 1 root wheel 19 9 10 11:13 test.txt
那为什么切换到个人账号后可以对这个文件进行写操作?
谢谢各路大神相助~
gaoleideMacBook-Air-2:tmp gaolei$ pwd
/tmp
gaoleideMacBook-Air-2:tmp gaolei$ whoami
gaolei
gaoleideMacBook-Air-2:tmp gaolei$ mkdir tmp
gaoleideMacBook-Air-2:tmp gaolei$ su -i
su: illegal option -- i
usage: su [-] [-flm] [login [args]]
gaoleideMacBook-Air-2:tmp gaolei$ sudo -i
gaoleideMacBook-Air-2:~ root# whoami
root
gaoleideMacBook-Air-2:~ root# cd /tmp/tmp/
gaoleideMacBook-Air-2:tmp root# vim test
gaoleideMacBook-Air-2:tmp root# cat test
hehe
gaoleideMacBook-Air-2:tmp root# exit
logout
gaoleideMacBook-Air-2:tmp gaolei$ whoami
gaolei
gaoleideMacBook-Air-2:tmp gaolei$ pwd
/tmp
gaoleideMacBook-Air-2:tmp gaolei$ cd tmp/
gaoleideMacBook-Air-2:tmp gaolei$ ls -al
total 8
drwxr-xr-x 3 gaolei wheel 102 9 10 19:09 .
drwxrwxrwt 10 root wheel 340 9 10 19:08 ..
-rw-r--r-- 1 root wheel 5 9 10 19:09 test
gaoleideMacBook-Air-2:tmp gaolei$ vim test
gaoleideMacBook-Air-2:tmp gaolei$ cat test
hehe
haha