Operating System - HP-UX
1830939 Members
2764 Online
110017 Solutions
New Discussion

Unable to set umask for a user! - HELP!

 
SOLVED
Go to solution
Pim Bliek
Occasional Contributor

Unable to set umask for a user! - HELP!

Whenever I create new user (using SAM) this user is unable to set the umask properly. Every user on the system has the wrong umask, and I'm unable to set it.

My situation:
- HPUX 11.0
- umask 644 in .profile of all users
- but every file I create has permissions -----w--w- (022)
- also in /etc/skel/.profile the umask is 644.

I use ksh as default shell.

Anyone any idea what I'm doing wrong??

Regards,
Pim Bliek
3 REPLIES 3
Deepak Extross
Honored Contributor
Solution

Re: Unable to set umask for a user! - HELP!

Do you want the files to be created with permissions 644?
In that case, set the umask to 022 in the user's .profile.

From the man page:
"For example, the mask u=rwx,g=rx,o=rx ( 022 ) disables group and other
write permissions. As a result, files normally created with a file mode shown by the ls -l command as -rwxrwxrwx ( 777 ) become mode -rwxr-xr-x ( 755 ); while files created with file mode -rw-rw-rw- ( 666 become mode -rw-r--r-- ( 644 )."
Frederic Sevestre
Honored Contributor

Re: Unable to set umask for a user! - HELP!

Hi,
I think you want to have files with 644 permissions. So you should use umask=022
See man umask.
Fr??d??ric
Crime doesn't pay...does that mean that my job is a crime ?

Re: Unable to set umask for a user! - HELP!

What is happenning is correct.
As a thumb rule

if you have a umask 644
1. for file permission deduct from 666
i.e in your case 022
-----w--w- (022)
2. for directory permission deduct from 777
i.e; in yourcase 133
d--x-wx-wx (133)

so if you create a directory it will have
d--x-wx-wx (133)

and file will have
-----w--w- (022)
permission

Manoj