1834248 Members
2099 Online
110066 Solutions
New Discussion

File permission issue

 
SOLVED
Go to solution
Gordon_3
Regular Advisor

File permission issue

Hi all,

Just have a scenario like this, our system does not set umask on system wide config , /etc/profile & /etc/csh.login, also NOT in the application ID, say abc, when we use abc ID to touch the file, file will be in 666 permission, however for the application itself generated file, like log file, it will be in 640. Donno why, is that apps itself can alter the file permission before it generate by means of system call and not affect by the one setting in .profile / .cshrc? Or in this case, using system default? Thx.

Gordon
Gordon
6 REPLIES 6
Mark Grant
Honored Contributor
Solution

Re: File permission issue

Gordon,

These kind of things are set by setting the "umask". Have a look at the man page but as an example, having a umask of "0022" will create file with "-rw-r--r--" permissions. However, there is nothing to stop an application changing umask itself or doing a chmod on files after it has created them.
Never preceed any demonstration with anything more predictive than "watch this"
Manish Srivastava
Trusted Contributor

Re: File permission issue

Hi,

The touch command uses the umask and sets the file permission. If the umask os 00 then it sets the file permission to 666. The application sets the permissions specifically for the logs as 640. The application has to pass the permissions to the systemcall and it may take it from the profiles or set the permission explicitly.

manish
Gordon_3
Regular Advisor

Re: File permission issue

Hi 2,

Thx, so it means it's possible for application itself to set desired permission without control from system default, right? And nothing we can do...

Gordon
Gordon
Mark Grant
Honored Contributor

Re: File permission issue

Gordon,

Not really. On the other hand, it might be dangerous to do it. An application that expects to have created an file with a particular permission setup might have a problem when it comes to access that file later.

I suspect, that whatever you particular problem is here, that there is another way to resolve it.

If you're having problems with people not being able to read a file created by your application, generally speaking, using "groups" will solve it.

Could you be a bit more specific about the problem you have and maybe we can help you find something.
Never preceed any demonstration with anything more predictive than "watch this"
Manish Srivastava
Trusted Contributor

Re: File permission issue

Hi,

If you have the source code of the application then you can change it but if it some third party application then the application decides the permissions of the log file.

manish.
Gordon_3
Regular Advisor

Re: File permission issue

Hi 2,

Yes, it's a 3rd party application, the situation is we create a app. ID for this app, and some our developed system , which has diff uid, wanna to access the log file, so we also temp. use group, add the developed system UID to group of the 3rd party apps.... thx .

Gordon
Gordon