Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im trying to serve similar content over two websites, but don't want to have 2 of each file, especially when they are growing.

The basics, im running CentOS, with cPanel.

Is it safe to do the following, I have folder downloads1 in


i have user2,

can i make a group - groupadd sharedfiles add both users to the group:

useradd -g sharedfiles user1
useradd -g sharedfiles user2 

then chown -r -v user1:sharedfiles downloads1/

User 2 i want to have


but i want it to be a symlink like

ln "downloads1" "/home/user1/www/downloads1/"

lrwxrwxrwx 1 user2 sharedfiles   11 May  9 14:20 downloads1 -> /home/user1/www/downloads1/

Is this a safe practice? Or is there a better way to do this if I want them both to be able to share the files for distribution over apache. Is there any drawbacks to this? Thanks in advance for any light shed on this. I'm not 100% sure weather this should have gone here or on serverfault.

share|improve this question

migrated from May 9 '10 at 20:49

This question came from our site for computer enthusiasts and power users.

this is better suited to Server Fault. we'll migrate it for you; you'll need to register a Server Fault account and associate your accounts (in your user profile, on the accounts tab) to regain ownership of the question. – quack quixote May 9 '10 at 20:49

The safest way to do this would be to create downloads1 outside of the home directories and create symlinks pointing to the outside location:

mv /home/user1/www/downloads1/ /shared/downloads1
chown -r -v :sharedfiles /shared/downloads1/
ln -s /shared/downloads1 /home/user1/www/downloads1
ln -s /shared/downloads1 /home/user2/www/downloads1

You will probably also want to make sure the permission bits are set appropriately. If the sharedfiles group should have different access than all others you may want to set the setgid bit as well so newly created files retain sharedfiles group membership:

chmod 2776 /shared/downloads1 # For shared writing

If one user should have permission to write but not the other you could do this:

chown user1 /shared/downloads1
chmod 766 /shared/downloads1 # For owner writing only
share|improve this answer
If you're using NFS and automount, you can have the automounter set up links for you. Basically a convenience for admining this if user1 user2 become ...userN, or if you want the files common across multiple servers. For the problem as given, though, I agree with Trey's answer. – mpez0 May 10 '10 at 0:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.