Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change default file create permissions

Status
Not open for further replies.

evergreean43

Technical User
May 25, 2006
165
US
Currently when I create a file on our Solaris 7 server it creates it with this:

Code:
-rw-rw-r--   1 jones  abcd           0 Jul 25 14:46 datafile

Please advise how I can change it so everytime I create a file it will be with these permissions:

Code:
-rwxrwxr-x   1 jones  abcd           0 Jul 25 14:46 datafile



 
You can't change your umask so a file is created with the execute bit turned on. You'll need to do a [tt]chmod[/tt] after it's created.
 
Can I change it to write permissions?

On another Server my file create gives me this:
Code:
-rw-r--r--   1 jones  abcd           0 Jul 25 14:46 datafile

I need this:
Code:
-rw-rw-r--   1 jones  abcd           0 Jul 25 14:46 datafile

 
This is controled by your [tt]umask[/tt]. Just type [tt]umask[/tt] and see what it says.

To make it create those permissions, the umask would be [tt]002[/tt]. Put the command "[tt]umask 002[/tt]" in your profile and that will set it whenever you log in.

Just to show what other values will do...
Code:
$ umask
02
$ umask 000
$ touch test.000
$ umask 002
$ touch test.002
$ umask 022
$ touch test.022
$ umask 222
$ touch test.222
$ umask 227
$ touch test.227
$ umask 027
$ touch test.027
$ umask 077
$ touch test.077
$ umask 777
$ touch test.777
$ ls -l test.*
-rw-rw-rw-   1 logs     users          0 Jul 25 19:07 test.000
-rw-rw-r--   1 logs     users          0 Jul 25 19:07 test.002
-rw-r--r--   1 logs     users          0 Jul 25 19:08 test.022
-rw-r-----   1 logs     users          0 Jul 25 19:13 test.027
-rw-------   1 logs     users          0 Jul 25 19:09 test.077
-r--r--r--   1 logs     users          0 Jul 25 19:08 test.222
-r--r-----   1 logs     users          0 Jul 25 19:09 test.227
----------   1 logs     users          0 Jul 25 19:09 test.777
$
"[tt]man umask[/tt]" for more information.
 
Thanks,

How can I make the umask command (such as umask 113)
work everytime I log in if I am using csh as my default login shell?

For ksh I can use this:
Code:
echo "umask 113" >> ~/.profile

What would be equivilant if I had csh as my default login shell?
 
Assuming you are in the home directory of the user, the simplest way would be:

echo "umask 113" >> .cshrc

 
Since the execute bit never gets set, the mask [tt]113[/tt] doesn't make a lot of sense. It's equivalent to [tt]002[/tt].

But linnorm is correct about setting it up.
 
Thanks,

This works if I create the file on Unix server using telnet or most anything except if I create a file using Dreamweaver it ignores the umask setting. I assume this is a Dreamweaver issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top