1833759 Members
2434 Online
110063 Solutions
New Discussion

Umask value problem

 
ramesh_4
Occasional Advisor

Umask value problem

hi,
I have a crazy problem. Most of the processes running in the server are creating files with the following permission -rw------. Even though in my /etc/profile i have the umask value for users oracle, root are set as 022 and for all other users 002. But even the files created by processes run as root have -rw------. Is there any solution for this?
like to find out new things and compare with other flavours of unix
6 REPLIES 6
Ravi_8
Honored Contributor

Re: Umask value problem

HI,
by setting umask in your .profile file should set your umask. have you executed profile file
#. ./.profile
never give up
Shahul
Esteemed Contributor

Re: Umask value problem

Hi

Please Check up whether any other system wide umask is set or not?

Manually U can check by setting the umask value and creating files. Follow these

#umask 777
#touch asd
#ll asd
Now asd's permission should be ---------.
#umask 000
#touch asd1
#ll asd1

Now permission is rw-rw-rw. Normally umask will not give executable permission. If U want to set executable permission use chmod command.

#umask 002 will give rw-rw-r permission

#umask 022 will give rw-r--r-- permission.


For more information see man page of umask and chmod.

Shahul
Frank Li
Trusted Contributor

Re: Umask value problem

The "umask" command in the user's profile (~/.profile ) will override the the setting in the /etc/profile .

So you should check the ~/.profile and set the correct umask for that user .
Hi Friend
A. Clay Stephenson
Acclaimed Contributor

Re: Umask value problem

Hi Ramesh:

Time for a little lesson. First, eventhough umask is set in /etc/profile, it can still br set later by the user's .profile. You need to check there or better yet from the shell do a umask and see if the value is what you expected.

Now let's suppose that your umask is set to 000. You would expect that all files created would have permission 777. But that is not the case because it also depends upon the creation mask.

In this example I'll use a umask of 002 and a creation mask of 0666.

At the system level, when a file is created, a call is made to creat("/tmp/myfile",0666)
Umask masks off the nonzero bits of the creation mask to actually create a file with permissions 0664 or rw-rw-r. In this case, if the umask had been set to 000 then the file would have been created with 666 permissions.


I suspect that there is nothing wrong, it's just that the combination of creation_mask and umask are not what you expect.

I hope I've been clear, Clay
If it ain't broke, I can fix that.
Magdi KAMAL
Respected Contributor

Re: Umask value problem

Hi

Attention the /etc/profile is a commun file for all user and the individual .profile file is overwritten what the /etc/profile is doing.

So normally, the .profile file for each user is complemantary to the /etc/profile.

You have to have a look to your .profile file and to set it to your desired value.

Magdi
Joe Colucci_1
Frequent Advisor

Re: Umask value problem

Ramesh,

All of the other replies are correct. However, you must also consider how you are logging in. By default, /etc/profile and the user's .profile are NOT read during a CDE login.

You probably want to set umask once in /etc/profile, then source /etc/profile during CDE logins. That way, everyone gets the same umask, no matter how they login.

To do that, you must modify /etc/profile to be CDE safe (fairly simple). Then, put a link to /etc/profile in /etc/dt/config/Xsession.d

--Joe