Re: File and directory permissions
Hi,
epsilon491@tutanota.com wrote:
> So what you say is this: if there is an open terminal before chmod 700, then
> I can use that terminal to access "apple", but after I close terminal B,
> there is no way to access that apple directory? Neither with a shall window,
> nor with another software?
It is not about the terminal but about the way how you get to directory
/opt/experiment/apple. If you are already in it, then you do not need
to read /opt/experiment where you have no permission.
$ mkdir experiment
$ mkdir experiment/apple
$ cd experiment/apple
$ chmod a-rwx ..
$ touch aaa
$ touch ../../experiment/apple/x
touch: cannot touch ‘../../experiment/apple/x’: Permission denied
$ touch ../../experiment/apple/aaa
touch: cannot touch ‘../../experiment/apple/aaa’: Permission denied
$ ls -ld ../../experiment/apple
ls: cannot access ../../experiment/apple: Permission denied
$ ls -ld .
drwxr-xr-x 2 thomas thomas 4096 Mar 7 12:38 .
The reason is that nobody is allowed to read ../../experiment and thus
to find ../../experiment/apple where i have permission to write.
> even in the same terminal, vi can't access the file aaa.
My vim can do on the first try.
I can store my edited file and exit vim.
But on the next try i get
Swap file ".aaa.swp" already exists!
although "ps -ef" confirms that no vim is editing "aaa".
After removing the swap file, i can edit and store again.
Again, the file ".aaa.swp" is not removed.
So vim has a problem with the nailed up parent directory. (Maybe because
it stores its absolute path after having created it by local path ?)
> 1.) To prevent this scenario, I have to do recursive chown and chmod.
At least it would be a less tricky situation.
Equal rights for all files of a tree !
But on the other hand, some files are more equal than others ...
Have a nice day :)
Thomas
Reply to: