?
Solved

Keep OWNER of a new file/directory

Posted on 2011-09-19
2
Medium Priority
?
559 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
[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
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 2000 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Users of Windows 10 Professional can disable automatic reboots using the policy editor. This tool is not included in the Windows home edition. But don't worry! Follow the instructions below to install (a Win7) policy editor on your Windows 10 Home e…
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

762 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