LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 08: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, 08:48 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 08:54 AM   #3
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
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, 10: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 11:38 AM.
 
2 members found this post helpful.
Old 01-31-2013, 01:12 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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, 09: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



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 02:25 AM
Any log file for checking file permission change history in RHEL 5.1? bilalcochin Linux - Newbie 3 04-02-2010 09:57 AM
regarding file permission for db2 backup image file lx4all Linux - General 1 12-13-2007 03:37 PM
change file permission of a mouse device file permanently alexandre_fs Linux - General 5 01-09-2007 06:30 AM

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

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