LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-31-2013, 09:46 AM   #1
yashfire007
Member
 
Registered: Jan 2013
Distribution: CentOS, RHEL 6.4
Posts: 79

Rep: Reputation: Disabled
File permission


If UMASK is set to 0077 or 0007, then the default permissions for new directories are 700 0r 770. Then what is the default permission for a new file..
 
Old 01-31-2013, 09:48 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Quote:
Originally Posted by yashfire007 View Post
If UMASK is set to 0077 or 0007, then the default permissions for new directories are 700 0r 770. Then what is the default permission for a new file..
Have a look here: Default permissions of newly created directories - post #4
 
Old 01-31-2013, 09:54 AM   #3
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
This is one of those things you could have tried for yourself and got a definite answer in about the time it takes to type the question here.
 
Old 01-31-2013, 11:54 AM   #4
vipin310379
LQ Newbie
 
Registered: Jan 2013
Location: Moga, Punjab
Distribution: Redhat
Posts: 19

Rep: Reputation: Disabled
umask............. file permissions ................. directory permissions
077 .......................... 600 ............................. 700
007 .......................... 660 ............................. 770
777 .......................... 000 ............................. 000

the rules in deciding what will be the permissions for newly created files & dir are

rule1:subtract the umask from default permissions to get effective permissions

.......: default file permission 666 default dir permission 777
............umask (for example) - 002 ..............................- 002
-----------------------------------------------------------------------------------------------------------------
effective permission............... 664 ................................ 775
---------------- ------------------

rule2 : newly created files can not have ëxecutable bit set

default file permission 666 default dir permission 777
umask (for example) - 077 (will be treated as 066) - 077
---------------- ------------------
effective permission 600 700
---------------- ------------------

default file permission 666 default dir permission 777
umask (for example) - 007 (will be treated as 006) - 007
---------------- ------------------
effective permission 660 770
---------------- ------------------

Last edited by vipin310379; 01-31-2013 at 12:38 PM.
 
2 members found this post helpful.
Old 01-31-2013, 02:12 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,959

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Quote:
Originally Posted by vipin310379 View Post
rule2 : newly created files can not have ëxecutable bit set
Not true. It depends on what the program creating the file asks for. A program must specify something in the mode argument when creating a file, and whatever value it puts there will be modified by umask and used as the permissions. Programs used primarily for non-executable files will usually use 0666 unless security concerns indicate that something stricter would be appropriate (e.g., programs that manage encryption keys). Programs like the linker (ld) that create executable files commonly use 0777.
 
Old 01-31-2013, 10:06 PM   #6
vipin310379
LQ Newbie
 
Registered: Jan 2013
Location: Moga, Punjab
Distribution: Redhat
Posts: 19

Rep: Reputation: Disabled
when you are normally creating a file using "vi", "touch", "cat" or by redirecting the output
or creating directories using "mkdir"

the 2 above mention rule mentioned in previous post will come into picture.
 
  


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
Reading ext3 file system on Mac and overriding file permission moravveji Other *NIX 6 09-12-2011 03:25 AM
Any log file for checking file permission change history in RHEL 5.1? bilalcochin Linux - Newbie 3 04-02-2010 10:57 AM
regarding file permission for db2 backup image file lx4all Linux - General 1 12-13-2007 04:37 PM
change file permission of a mouse device file permanently alexandre_fs Linux - General 5 01-09-2007 07:30 AM


All times are GMT -5. The time now is 04:34 AM.

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