LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-27-2005, 03:54 PM   #1
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Rep: Reputation: 15
Default directory permissions


Is it possible to have a default set of permissions for newly created directories? And, if so, is it possible to set this on a per-directory basis?

For example, say I have a directory ~/somedir

Is it possible to have all directories created inside of somedir have a default set of permissions?
 
Old 08-27-2005, 04:10 PM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Re: Default directory permissions

Quote:
Originally posted by gwroy20
Is it possible to have a default set of permissions for newly created directories?
you can set default permissions for directories and files using the "umask" command. The argument are octal digits representing permissions which are not given by default. For example, the common "umask 022" sets directories to 755 permissions and files to 644 permissions (i.e. the write permission, 2, for group and world are taken away from the full 777 and 666 permissions for directories and files respectively).
 
Old 08-27-2005, 04:13 PM   #3
mherring02
Member
 
Registered: May 2005
Location: Pasadena, CA
Distribution: Ubuntu, Fedora
Posts: 50

Rep: Reputation: 15
is umask a global command that affects multiple directories or does it really set the system to setup NEW directories in a certain way.
I think maybe the OP was looking for the latter
 
Old 08-28-2005, 03:03 AM   #4
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Original Poster
Rep: Reputation: 15
Yes, I was looking for a way to have new directories be set up with a default set of permissions.
 
Old 08-28-2005, 03:24 AM   #5
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Yes, umask affects the default permissions for new files and directories.
 
Old 08-28-2005, 02:57 PM   #6
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
The umask mask doesn't allow you to set default permissions, it only ensures that the bits in the mask are not set. If you have a umask of 022 and create a file with a mode of 766 it'll be created with permissions of 744.
 
Old 08-28-2005, 03:11 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by eddiebaby1023
The umask mask doesn't allow you to set default permissions, it only ensures that the bits in the mask are not set. If you have a umask of 022 and create a file with a mode of 766 it'll be created with permissions of 744.
You got me curious: how do you explicitly create a file
with 766?


Cheers,
Tink
 
Old 08-28-2005, 04:30 PM   #8
mherring02
Member
 
Registered: May 2005
Location: Pasadena, CA
Distribution: Ubuntu, Fedora
Posts: 50

Rep: Reputation: 15
I don't know about CREATING, but here's the command to change access:

chmod <XYZ> <filename>

X, Y, and Z are the octal codes for the permission flags---for example: 7 (octal) = 111 (binary) ---this sets read, write and execute all true.

You have to be logged in as the file owner to run this.

For more info: man chmod
 
  


Reply



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
Default directory and file permissions kodon Slackware 12 02-13-2020 01:49 PM
default permissions skel Linux - Security 1 12-14-2004 06:27 PM
directory permissions reverting to default Edrin Linux - Newbie 4 11-18-2004 11:05 AM
Default Directory Permissions tranquil222 Linux - Software 8 05-20-2004 05:10 PM
write permissions for directory - not accidently move/deleted the directory linuxgamer Linux - Newbie 10 12-02-2003 03:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:11 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
Open Source Consulting | Domain Registration