Solved

Directory and File Permissions

Posted on 2006-10-21
6
275 Views
Last Modified: 2010-04-20
Hi!

I've got a directory within a user's home directory called "logs". The permissions for this file are:

drwxrwxr-x (775)
webxxx:www-data

"www-data" is the user running as the web server. Text files (logs) are automatically created in this directory by the server. The files created have the following permissions:

-rw-r--r-- (644)
www-data:www-data

My question is: is there any way to automatically make the created log files have the following permissions ? ( when the files are created ) :

-rw-rw-r-- (664)
webxxx:www-data
0
Comment
Question by:Julian Matz
6 Comments
 
LVL 43

Assisted Solution

by:ravenpl
ravenpl earned 125 total points
ID: 17783235
Put into apache startup script
umask 0002 # instead default 0022. Also read 'help umask'

But in general case there's no way to force user/application to create files/dirs with predefined permissions.
0
 
LVL 40

Expert Comment

by:noci
ID: 17783244
There is a possibility if you have ACL support in your kernel and on your file system, and it is enabled through mount.
 The default acl on a directory can define the settings needed for new files.
0
 
LVL 40

Assisted Solution

by:noci
noci earned 125 total points
ID: 17783261
BTW 'man setfacl' & 'man getfacl' should give you a starting point.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 5

Assisted Solution

by:Yogalingam
Yogalingam earned 125 total points
ID: 17783608
0
 
LVL 8

Accepted Solution

by:
nitadmin earned 125 total points
ID: 17786321
Go to the home directory and look at your .profile file.
in here you can configure umask command.

1. cd /home/www-data
2. use ls-al  command to see all the files. In your home directory there files that begin . (dot), like .bash, .profile.
3. Use your favorite text edit to edit the .profile file.
4. Inside the .profile change the umask 022 to umask 002.

However, I will be carefull doing this because this change may cause problems later.

Cheers,
Nitadmin
0
 
LVL 21

Author Comment

by:Julian Matz
ID: 17886594
Thanks!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now