Solved

Directory and File Permissions

Posted on 2006-10-21
6
274 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 39

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 39

Assisted Solution

by:noci
noci earned 125 total points
ID: 17783261
BTW 'man setfacl' & 'man getfacl' should give you a starting point.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

744 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

14 Experts available now in Live!

Get 1:1 Help Now