Operating System - HP-UX
1748249 Members
3659 Online
108760 Solutions
New Discussion юеВ

Re: log file permisson changed

 
Salm
Frequent Advisor

log file permisson changed

Hi

My hpux itanium server rx600 11.23 running some archive applications. application user creating every day log files into the /var/adm/XXXXXX/log/messages/ directory with world writble permission. Is any one can adivce how to set file permission 755 for every day new files ?

I checked umask is set 022. Should I need to set up any umask value in user .profile ?

Thanks in advance


9 REPLIES 9
Johnson Punniyalingam
Honored Contributor

Re: log file permisson changed

>>I checked umask is set 022. Should I need to set up any umask value in user .profile ?<<<

Yes
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: log file permisson changed

Please below link for more information

http://www.unix-manuals.com/forum/viewtopic.php?p=384
Problems are common to all, but attitude makes the difference
Salm
Frequent Advisor

Re: log file permisson changed

Hi

Thanks for your reply.I set up the umask value 022 in user .profile, but it not worked . the new log file just created with same initial values

-rw-rw-rw- 1 lead otex 766 Jan 22 23:20 job_TA_1509.log
Johnson Punniyalingam
Honored Contributor

Re: log file permisson changed

I set up the umask value 022 in user .profile, but it not worked . the new log file just created with same initial values <<

can you login as that user and create file and check the permission ?

Login :- abcd
password

#touch log
# ll -l log
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: log file permisson changed

>>/var/adm/XXXXXX/log/messages/ <<

I believe above mentioned folder "owner" belongs" to "root"

its better to write script to find those file and change the permissions as per your requirement?

why does your application dumping some archive applications file under "Operating System" file system /var/adm

its always better to keep all you application files and logs . away from operating system files and directory structure

or try changing the "umask" value for "root"
Problems are common to all, but attitude makes the difference
Steven Schweda
Honored Contributor

Re: log file permisson changed

Find the process which creates the log file.
_That_ is where the umask needs to be set.
Changing "user .profile" helps only if that
process actually uses "user .profile".
Salm
Frequent Advisor

Re: log file permisson changed



Yes I SU the user "lead" and created file which is good , but still original log file creating with writable permission.
root@ # id
uid=20002(lead) gid=207(otex) groups=201(dba)
root@ # touch log
root@ # ll -l log
-rw-r--r-- 1 lead otex 0 Jan 23 00:01 log

===================================
Follwing is original file created by user

-rw-rw-rw- 1 lead otex 766 Jan 22 23:00 job_1595.log
-rw-rw-rw- 1 lead otex 766 Jan 23 00:00 job_1598.log
Johnson Punniyalingam
Honored Contributor

Re: log file permisson changed

>>Find the process which creates the log file.
_That_ is where the umask needs to be set.<<<

Hi Salm, -> look comment from >>Steven Schweda<< -> he is right, I agree
Problems are common to all, but attitude makes the difference
Raj D.
Honored Contributor

Re: log file permisson changed

Salm,
Have you tried below:

1. After logged in check umask value.
# umask
# echo $SHELL

Check .profile and /etc/profile for umask value should be 022

2. touch a file and dir and check the value.
# touch abc
# mkdir abc_dir
# ll -d abc_dir

You should be getting 755 i.w ( drwxr-xr-x ).

3. If #2 is ok, then check the permission by creating a file manually in the log directory. If it works ok. Else you have to use a function in the script while logfile creation.


HTH,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "