1833841 Members
2938 Online
110063 Solutions
New Discussion

permission

 
SOLVED
Go to solution
Sanjiv Sharma_1
Honored Contributor

permission

Hi,

I have sent the umask 077.
Now when I create a file with vi or touch.
It sets the permission of the file as
-rw-------
But it should be -rwx------.
Why is it so?

Thanks,
Everything is possible
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: permission

This is actually working as it should.

Files are NEVER created with the execute 'x' bit set, no matter what.

The only way to get the execute bit set on the permissions is with chmod.
A. Clay Stephenson
Acclaimed Contributor

Re: permission

No, it's doing just right. There are two components at play: 1) The file's creation mode and 2) umask - which "subtracts" from the creation mode. Ordinary files have a creation mode of 666; umask can't take away bits that were never set. Directories under the shell are created under a creation mode of 777. In order to set the execute bit under the shell, you must first create the file and then issue an explicit chmod command. Under a programming language, like C, you can do it all in one shot but not the shell.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: permission

The original desigers of Unix perferred that a conscisious decision be made before a file became executable.

Think for a moment how dangerous it would be if every file you created was a script capable of potentially damaging the system.

It is working just the way its suppposed to.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
T G Manikandan
Honored Contributor

Re: permission

Text files and ordinary files have default permissions of 666
Directories and executables have 777.

So when you have umask 077

666
077
--------
rw------
--------