Solved

Directory and File Permissions

Posted on 2006-10-21
6
276 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CentOS 7 Installation 7 74
VLC Video Player No Longer Works after installing HandBrake, Fedora 25 5 219
CENTOS DHCP Server / PXE/TFTP 14 80
awk to variable in bash 2 43
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

803 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