Web lists-archives.com

Re: File and directory permissions

7. Mar 2018 11:27 by tomas@xxxxxxxxxx:

> I can't reproduce, either. Once the chown to root happens, non-root

> user can't touch files in directory. Ext4.

I double checked. Sorry the previous example was not good. To reproduce the issue, you have to create another directory inside the top one. Here is a working example:

# terminal A


mkdir /opt/experiment/

chown aristo:aristo /opt/experiment

mkdir /opt/experiment/apple

chown aristo:aristo /opt/experiment/apple

# terminal B,

whoami # aristo

cd /opt/experiment/apple

touch aaa # OK

# terminal A

chown root:root /opt/experiment

chmod 700 /opt/experiment

# terminal B

pwd # Gives /opt/experiment/apple

touch bbb # OK bbb is created

cd /opt/experiment/apple # Gives permission denied

# new terminal C

cd /opt/experiment/apple # Denied

touch /opt/experiment/apple/ccc # Denied

Note that, after chmod 700, in terminal B you can still create files, although you cannot cd into apple.