joined:Jan 9, 2014
I have an account with a directory full of images that are regularly changed by scripts in the account. I have another account, and I want its scripts to be able to add / delete images in that same directory.
Eg, main directory:
should be able to be modified by user "example" and user "new".
I set up a symlink from the new account to the main directory, ala:
ln -s /home/example/www/images/ /home/new/
and the scripts in /new/ can read the files in /example/www/images/, but can't upload new ones. FWIW, the permission for the main directory is 0777.
I should mention that there are 6 directories in /example/ that I really want to share.
Can I just make "new" a user for the existing "example" without any real problems? Eg:
# Add "new_username" to group "example"
usermod -aG example new_username
# Change permissions for each directory to be shared
chmod -R 2777 /home/example/images/
If not, then what if I created /home/shared/ manually (not as an account), then symlink the directories in both /example/ and /new/ to it? Like so (I think):
# Create group
# Setup username and password for new group
# (do I just make up a username and password here?)
useradd -d /home/shared/ -g shared -m shared_username
# Add /example/ as a user
useradd -d /home/shared/ -g shared example_username
# Add /new/ as a user
useradd -d /home/shared/ -g shared new_username
# Change group ownership
chown -R shared_username:shared /home/shared/
# Set group permission
chmod -R 2775 /home/shared/
ln -s /home/shared/www/images/ /home/example/
ln -s /home/shared/www/images/ /home/new/
I would much rather not have to create a separate directory, because that would mean a lot of script modifications to /example/; and, of course, the account's stats (storage and bandwidth) would be wrong. But, if it's the best option, it CAN be one.
If neither of these are good options, what's a better idea?