Operating System - HP-UX
1833589 Members
4158 Online
110061 Solutions
New Discussion

File permission is changed.

 
SOLVED
Go to solution
Macho_2
Frequent Advisor

File permission is changed.

When some job process in one of my directory, it will copy file to process and will over write it again ,but the permission was changed automatically to rw- r-- --- (like a default)so the next process can not over write the file again coz permission is changed. The original permission was rw-rw-r-.
How can we set the permission to be rw-rw-r- ?

Pls give me some advice regarding of this problem.
8 REPLIES 8
Stephen Keane
Honored Contributor

Re: File permission is changed.

Check your umask

If you are creating a file rw-r-----, that suggest your umask is set to 0133, if you want rw-rw-rw then it should be something like 0111. Maybe your process should change it, or call chmod on the file when it has finished?
Hoang Chi Cong_1
Honored Contributor

Re: File permission is changed.

Hi
Next time, don't forgot use "-p" option....
With -p option, the file permission will be keep......

Regard,
HoangChiCong
Looking for a special chance.......
Nguyen Anh Tien
Honored Contributor

Re: File permission is changed.

Which user do you use?
open users's profile (.profile) and add Umask
#vi .profile
UMASK 0113
->save and then logout
Next time your script will use Umask to mask you file.
tienna
HP is simple
Kevin Wright
Honored Contributor

Re: File permission is changed.

files are created with default perms of 666. rw-rw-rw-. Dirs are created with default perms of 777. rwxrwxrwx.

You subract the defined umask variable from the above values to determine the perms on the file created:

To create a file with rw-rw-r--, your umask needs to be 0002.

to create a file with rw-r----, your umask needs to be 0026.

Set this in your script.
Macho_2
Frequent Advisor

Re: File permission is changed.

Hi Kevin;

In which script I need to add the umask 0002 ?
For you information, the directory that coz permission actually under oracle user.
Robert-Jan Goossens
Honored Contributor
Solution

Re: File permission is changed.

Hi,

Before changing the umask, check where it is set.

# grep umask /etc/profile
# grep umask /home/oracle/.profile
If you change it in the profile it will be a system wide change !!

# cd /home/oracle
# vi .profile
umask 0002

Regards,
Robert-Jan
Macho_2
Frequent Advisor

Re: File permission is changed.

Hi;

If I edit the umask 0002 under /home/oracle/.profile file, is it will change permission rw-rw-r to all the files and directory under oracle.
Robert-Jan Goossens
Honored Contributor

Re: File permission is changed.

NO, only the files being written from the orcale user. The umask setting will NOT chown the directory + files of the /home/oracle user.