1833141 Members
4267 Online
110051 Solutions
New Discussion

Sharing home directory

 
SOLVED
Go to solution
Jayesh shah
Frequent Advisor

Sharing home directory

Hi,

Can I setup two users to share same directory?
Are there any restrictions such as they should belong to same group etc? Any other restrictions on the name of the home directory?


Regards,
Jayesh
5 REPLIES 5
steven Burgess_2
Honored Contributor

Re: Sharing home directory

Hi Jayesh

extract from the man page regarding useradd command

A directory can be shared between the users belonging to the same group. If the home directory is in the unshared mode and a new user is allocated to that directory then it will be put into the shared
mode by setting the permissions of that directory to 775 (i.e.
includes the write permissions to the group as well). Also, the
directory which will be shared should have read and execute
permissions for the group. Otherwise, useradd will report an error.

Do

man useradd for more info

I have attached some notes i put together for myself regarding useradd also

Hope this helps

Steve
take your time and think things through
Arockia Jegan
Trusted Contributor

Re: Sharing home directory

I thing there are no restrictions on the name of the home directory .

Both the users should be in the same group or atleast the group of user1 should be the secondary group for the user2. And group should have the required permissions for the directory(775 if you want to have full permissions.).
steven Burgess_2
Honored Contributor

Re: Sharing home directory

Jayesh

To create your initial user belonging to group admin

useradd -m steevo -g admin

Creates home directory with files from /etc/skel

Add another user belonging to the same group, keep in mind directory permissions as previously stated to allow full access

useradd -d /home/steevo steevo1

will create user steevo1 having a home directory steevo

You also have usermod commands to change parameters for users when required

Hope this helps

Steve
take your time and think things through
Tim D Fulford
Honored Contributor
Solution

Re: Sharing home directory

With the above caveats there is no problems with users sharing a home dir. However, when we did it (most users shared a home dir) we made sure the .profile was read only and owned by root. This way there was no chance of one persone chaging the way another user's profile. In short YOU start to have to administer/decide how the users work, it can be an unwanted extra overhead.

Tim
-
Wodisch_1
Honored Contributor

Re: Sharing home directory

Hello Jayesh,

just make sure that those *sharing* users do have different "$HISTFILE" settings, like:
export HISTFILE=$HOME/.sh_$(logname)_history

in the shared "$HOME/.profile" or "$HOME/.shrc".
That way they won't disturb each other's history!

Just my $0.02,
Wodisch