![]() |
Creating a group home directory
I want to create a directory in /home that several users can access so I can put shared files in there (Music, Photos, Videos, etc)
I was thinking I could create a group called 'share' and a directory called /home/share and set it up so members of the group have full access to this directory. So my questions are... Do all directories in /home have to be user accounts, ie if I create /home/share will Linux want to create a user called 'share'? Can groups have /home folders? Is /home a good place to be storing shared files? I ask this because I have /home on a large partition and it would be nice to have users' files and shared files kept on the same partition. |
Your plan is pretty much spot-on... /home is the best place for user data files.
No, your system won't require you to create a user to make a new directory in /home. You can create all the subdirectories you want. The one stumbling point might be adding new files and subdirectories to /home/share... When you first create it and stuff a bunch of files in there, you will have use chown to change the ownership of the directory and files to the group. If user bob adds more files later, they should be readable by other users, but they might not be writable. You might want to look into Samba or NFS to share the folder to the users, because those programs can take care of file permissions automatic'ly. |
Quote:
|
As mentioned, you are basically doing this correctly.
To handle the permissions, you can change the permissions like this: 1) create a folder: mkdir /home/shared 2) make a shared group name in /etc/group 3) make all the users that need access to this shared location, members of the shared group. 4) change the ownership on the shared folder: chown root:shared /home/shared 5) change the perms on the shared folder again: chmod 770 /home/shared 6) apply the guid on the shared folder: chmod g+s /home/shared Now when new files are added to this folder, no matter who adds them, they will have a group owner the same as the folder owner - e.g. shared. As the group owner has r/w capabilities, they will be able to modify. |
Cool... A sticky group. You learn something new every day.
|
Thanks, that's brilliant.
As directed by someone on another forum I ended up hiding the folder by naming it /home/.share Then I put symlinks into users' accounts like this: Code:
ln -s /home/.share /home/user1/share |
Perhaps a more elegant solution?
Ubuntu comes with an /etc/profile that includes this:
Code:
if [ -d /etc/profile.d ]; thenTo set the permissions for the script, type: Code:
sudo chmod 750 /etc/profile.d/group.sh |
Just to be pedantic
Quote:
Quote:
|
| All times are GMT -5. The time now is 12:40 AM. |