How to set permissions for files which get rolled over?

Thread Tools Search this Thread
Operating Systems Linux SuSE How to set permissions for files which get rolled over?
# 1  
Old 09-25-2011
How to set permissions for files which get rolled over?


One application that I have generates log files into a specific folder in SUSE. When the size of the log file reaches 50 MB, it gets rolled over and it is stored as testlog_1.log and the new events are logged in testlog.log

When I set a chmod -R 744 on the directory of these logs, it applies only to the files that were present at that moment. So, the new files that are generated afterwards don't get the same permissions.

One way to achieve this was to run a cron job for every 30 mins and execute the chmod command.

But is there a simpler and feasible way?

Thanks in advance,
# 2  
Old 09-25-2011
You can set it in logrotate.conf per log file you are rotating (not directory)

Check option in logrotate manual :
create mode owner group
# 3  
Old 09-25-2011
Thanks for the reply. The log rotation is taken care by the application itself. Automatically the logs get rotated. But i wanted to give read only access to users other than root.
# 4  
Old 09-26-2011
How is the application rotating the logs ?
Does it copy and make it zero size or something like that ?

If the files get zeroed after rotation, then you can use ACL to give read permission to another user, beside root.
If the app creating (as root) new filename (log), then you will need to setup your application to make the neccesary permission changes after rotation.

Hope that helps
# 5  
Old 09-26-2011
set a umask value in for the user that creates the logs, then they will be created with the permissions you specify instead of what im guessing is your system default.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Set ACL permissions Solaris

I want to set ACL permissions using this command in solaris 10 , but I get an error message. server# mkdir dir1 server# setfacl -m user:allan:rwx dir1 setacl error: Operation not applicable Any one can help in this matter. Please use CODE tags as required by forum rules! (2 Replies)
Discussion started by: AbuAliiiiiiiiii
2 Replies

2. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

3. Solaris

Change permissions for files

Hi! I have a dir in a server, that receives files with the wrong permissions, so I decide to put on a cron entry that changes its permitions, but because of the time gap, not all of them get changed. What I did was the following: ... (14 Replies)
Discussion started by: fretagi
14 Replies

4. Red Hat

Set permissions for new files created by application

Hello All, I have an application that creates the log files and they created with 600 permissions instead of 644(default). How can I set the permissions so that files can be created with 644. I looked into the /etc/profile for the umask settings and it is set 002(if UID>199). And when I type... (5 Replies)
Discussion started by: s_linux
5 Replies

5. UNIX for Dummies Questions & Answers

To set different file permissions for different users of same group

Hi, If User1, User2 and User3 are in the same group. User1 should not be able to view the files of User2 and User3. But User2 and User3 should be able to view all files. How to set permission for this. Please help. Thanks, Priya. (1 Reply)
Discussion started by: banupriyat
1 Replies

6. Shell Programming and Scripting

Finding compound words from a set of files from another set of files

Hi All, I am completely stuck here. I have a set of files (with names A.txt, B.txt until L.txt) which contain words like these: computer random access memory computer networking mouse terminal windows All the files from A.txt to L.txt have the same format i.e. complete words in... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

7. UNIX for Dummies Questions & Answers

files with different permissions are getting creater

Hi, Within a SQL file i am calling 5 shell scripts in back ground and redirecting their outputs to different log files in a specific directory. Now when I observed is, the log files are created with different permissions even though i did not do any thing specific. For example in... (3 Replies)
Discussion started by: steria_learner
3 Replies

8. Shell Programming and Scripting

Can is set permissions temporarily?

I want to do just what the title says. Here's why: I am adapting a script that backups to a mount. In the script it has a catch where if the drive isn't RW then it unmounts and attempts to remount RW. # attempt to remount the RW mount point as RW; else abort $MOUNT -o remount,rw... (3 Replies)
Discussion started by: Movomito
3 Replies

9. UNIX for Dummies Questions & Answers

Permissions on link files

Does any one now if you can change permissions on a linked file with out completely removing it and then relinking it? (2 Replies)
Discussion started by: moviestud80
2 Replies
Login or Register to Ask a Question