changing default file permissions | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

changing default file permissions

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-16-2005
FredSmith FredSmith is offline
Registered User
 
Join Date: Sep 2005
Last Activity: 13 April 2009, 7:50 AM EDT
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
changing default file permissions

How can I change the default permissions that are assigned when I create a file? (By default the file has: -rw-r--r-- ..... I'd like it to be -rw-r-----

How can I change this default behavior?
Sponsored Links
    #2  
Old 12-16-2005
BOFH BOFH is offline Forum Advisor  
Registered User
 
Join Date: Feb 2005
Last Activity: 7 May 2012, 4:35 PM EDT
Location: Longmont, CO
Posts: 411
Thanks: 1
Thanked 5 Times in 5 Posts
Quote:
Originally Posted by FredSmith
How can I change the default permissions that are assigned when I create a file? (By default the file has: -rw-r--r-- ..... I'd like it to be -rw-r-----

How can I change this default behavior?
man umask

Carl
Sponsored Links
    #3  
Old 12-17-2005
shafique shafique is offline
Registered User
 
Join Date: Nov 2005
Last Activity: 9 January 2011, 2:43 PM EST
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
try this
$chmod 644
    #4  
Old 12-18-2005
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
 
Join Date: Sep 2004
Last Activity: 26 July 2012, 3:38 PM EDT
Location: USA
Posts: 512
Thanks: 0
Thanked 2 Times in 2 Posts
put the following in .profile


Code:
umask  026

Sponsored Links
    #5  
Old 12-27-2005
FredSmith FredSmith is offline
Registered User
 
Join Date: Sep 2005
Last Activity: 13 April 2009, 7:50 AM EDT
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
I put umask 077 (the permissions that I want, RWX for owner, nothing for group or all) in the .profile.

But after I logout and log back in, it's as if it is not working. Is .profile the correct file to put this line into?
Sponsored Links
    #6  
Old 12-27-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 20 December 2014, 10:46 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 440 Times in 261 Posts
You need to put the line in the startup file for whatever shell you are using. That way, when your shell starts after you login, it will set the umask. .profile is a common name for the startup file. But we need to know what shell you use to be sure.
Sponsored Links
    #7  
Old 12-27-2005
FredSmith FredSmith is offline
Registered User
 
Join Date: Sep 2005
Last Activity: 13 April 2009, 7:50 AM EDT
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
echo $SHELL
/bin/ksh


Thanks!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
HELP changing file permissions live2learn Shell Programming and Scripting 10 12-12-2008 11:31 AM
changing /cn@0:console file permissions ErnieG Security 4 12-04-2007 08:39 AM
changing permissions on a 444 file (ie chmod 444) ajcannon UNIX for Dummies Questions & Answers 1 08-31-2007 11:48 AM
Changing file permissions FredSmith UNIX for Dummies Questions & Answers 7 05-17-2006 09:15 AM
changing file permissions gagansharma Shell Programming and Scripting 0 11-27-2001 11:26 PM



All times are GMT -4. The time now is 05:34 PM.