LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-15-2017, 05:07 AM   #1
peter7089
Member
 
Registered: May 2016
Posts: 86

Rep: Reputation: Disabled
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?
 
Old 03-15-2017, 05:21 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,603

Rep: Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361
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
 
Old 03-15-2017, 05:37 AM   #3
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,463
Blog Entries: 3

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
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/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Inherit parent directory permissions without using ACL ? sahil0512 Linux - Newbie 1 12-26-2016 02:34 AM
Restoring directory and subdirectory permissions/ownership nativetongue03 Solaris / OpenSolaris 1 03-22-2014 09:51 AM
Directory ownership or permissions inside another directory Slyfox696 Linux - Newbie 3 11-02-2012 03:14 PM
inherit permissions of the parent directory in newly created file abhijit_mohanta Linux - Newbie 1 09-10-2009 07:45 PM
Samba - Inherit Permissions from Parent Directory bence8810 Linux - Software 6 08-03-2006 07:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration