Red Hat Bugzilla – Bug 79015
umask is not working properly - /usr/lib/perl5/5.6.1/i386-linux/auto/POSIX/umask.al
Last modified: 2007-04-18 12:48:50 EDT
Description of Problem:
When I run the umask command as root the output is 0022 but when I create a file
as root the permissions are -rw-r--r--. Based on the documentation I have read
the permissions should be -rwx-rx-rx based on that umask.
Also, when I run the umask command as aplata (my user login) the output is 0002
but when I create a file the permissions are -rw-rw-r--. Shouldn't it be
-rwx-rwx-rx based on that umask? I'm confused. The strange thing is when I run
umask -S the output displayed is what I think the file permissions should be. So
why dosen't the shell create my file with the proper permissions? I also set the
umask for all users in the /etc/profile and I still get the same thing.
Another thing I noticed is that when I set the umask to 002 in root's
.bash_profile and restarted .bash_profile for root the umask would change to
0002 only if I logged in as root in text mode by hitting CTRL+ALT+F1 but would
not change when using Konsole in KDE and remained at 0022. What I mentioned in
the first paragraph also remained the same.
Your help is much appreciated.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. edit /etc/profile to add umask of 002 or add umask 002 to Root's .bash_profile.
2. restart computer or restart .bash_profile if Root.
3. create file using touch filename as user or as Root.
File permissions are rw-rw-r-- when file is created.
(If done as Root you will only see this if logged into text mode)
As the user or Root the permissions should be u=rwx,g=rwx,o=rx
When replying back to me can you please CC: email@example.com
Nothing in this "bug" AFAICS relates to perl.
Anyhow, if you want to know how umask works, see
man 2 mkdir
etc. In short, the umask is a *mask* of what is specified by the program that
creates the file. So if the program tells not to set --x--x--x, it won't be.
Not a bug
The umask is applied to the permissions the program requests. Perl like most
apps says create with rw-rw-rw and the umask turns it to rw-rw----