Solved

Keep OWNER of a new file/directory

Posted on 2011-09-19
2
550 Views
Last Modified: 2012-06-21
Hey Guys!

I need to keep ownership of new files or directories created by any user.

Example:
I have:
drwxr-xr-x 2 apache apache 1 Sep 19 11:17 /var/www/htdocs/website/

So, I need that when any user creates a new file or directory that inherit owner and group.

The group I resolved by setting sgid, so the group is inherit but the OWNER I dont know.

I do not like to create a shellscript and run it every 5 minutes thru crontad. It's a poor solution...

Some hint?
0
Comment
Question by:tbsoares
2 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36560769
using chown in a script is the only way to accomplish this in Linux.  setuid is ignored on directories.
0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 500 total points
ID: 36570707
You can change the group permission to "writeable" then "apache" daemon can manipulate the files without be the owner of that files.

Just make sure all the user have
umask 002
  in there ~/.bashrc, ~/.profile or ~/.cshrc  file
   So all the the created files are group writeable.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: btan
The intent is not to repeat what many has know about Ransomware but more to join its dots of what is it, who are the victims, why it exists, when and how we respond on infection. Lastly, sum up in a glance to share such information with more to help…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

707 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

17 Experts available now in Live!

Get 1:1 Help Now