Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inherit permissions

Status
Not open for further replies.

wolf2x

IS-IT--Management
Dec 26, 2000
107
0
0
US
It seems silly asking this question but honestly I don't know how to do this.

Let's say I have a folder called "main". I set the permissions so that everyone can read and write to it.

How can I set the permissions so that if I create a subfolder called "folder1", the folder will inherit the permissions of its parent folder ("main")?

thanks in advance.
 
mkdir -m xxx FOLDER_NAME

Where xxx is the permissions you want. If you want -rwxr-xr-x, then:

mkdir -m 755 FOLDER_NAME

Sort of like chmod on the fly. The same holds true if you create multiple folders like this:

mkdir -m 777 -p FOLDER1/FOLDER2/FOLDER3/....etc.
 
You could first create all the subdirs first...

mkdir main
mkdir main/sub1
mkdir main/sub1/sub2

...then do...

chmod -R 775 main

...this will do a recursive "-R" chmod starting
at "main"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top