Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
Ubuntu comes with an /etc/profile that includes this:
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
It should work with any distro, though, and I've successfully created a file called /etc/profile.d/group.sh and given it group read permissions. The script then gets run for members of that group only.
If your /etc/profile doesn't already contain the first block of code, you should be able to just copy it in. But I'd replace the -r with -x, thus making it depend on group execute permissions, which is technically more correct. The code to type above would remain the same.
Last edited by Michael Scheper; 09-06-2012 at 07:25 PM.
Reason: to clarify why I'd replace -r with -x