LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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
 
LinkBack 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: 47
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: 47
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: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
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


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
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 and file permissions kodon Slackware 10 08-08-2004 08:27 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


All times are GMT -5. The time now is 06:02 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration