LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Understanding parent directory permissions and ownership? (https://www.linuxquestions.org/questions/linux-newbie-8/understanding-parent-directory-permissions-and-ownership-4175601801/)

peter7089 03-15-2017 04:07 AM

Understanding parent directory permissions and ownership?
 
If a parent directory is owned, for example, by root:root inside the directory a user that don't have sudo rights can't create files and folders. But if i user with sudo rights create folders and files inside the directory and change the ownership of the files and folders to the user with no sudo rights the user with no sudo rights can't delete these files and folders but can change their permissions. Is this all the user with no sudo rights can do?

pan64 03-15-2017 04:21 AM

you mixed two different things. The permissions on files/directories and the sudo rights.
see man chmod for example about permissions or here: https://en.wikipedia.org/wiki/File_system_permissions

Turbocapitalist 03-15-2017 04:37 AM

One difference to remember between files and directories is that the execute bit for directories simply allows 'passing through' the given directory. So with the following settings you can pass through X and A but not B, but in no case actually list the files.

Code:

sudo mkdir -p /tmp/X/A/Y/
sudo mkdir -p /tmp/X/B/Z/
sudo chmod 701 /tmp/X/
sudo chmod 701 /tmp/X/A/
sudo chmod 700 /tmp/X/B/

sudo chown peter7089 /tmp/X/A/Y
sudo chown peter7089 /tmp/X/B/Z

ls /tmp/X/A/Y/
ls /tmp/X/B/Z/
ls /tmp/X/A/
ls /tmp/X/B/
ls /tmp/X/

chmod 700 /tmp/X/A/Y/
chmod 700 /tmp/X/B/Z/
sudo chmod 700 /tmp/X/B/Z/



All times are GMT -5. The time now is 03:38 AM.