?
Solved

Directory and File Permissions

Posted on 2006-10-21
6
Medium Priority
?
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 43

Assisted Solution

by:ravenpl
ravenpl earned 500 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 500 total points
ID: 17783261
BTW 'man setfacl' & 'man getfacl' should give you a starting point.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 5

Assisted Solution

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

Accepted Solution

by:
nitadmin earned 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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 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…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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