I want to create two users (e.g. adm1 and adm2), because each of them wants his own password, to which he is used. They shall share the same home directory however, let's call that admx.
Is this possible?
If it is: How does one achieve it?
(of course they both will belong to the same group=admx)
I would not recommend using the same home directory for multiple users, because important config files are located in the home directory. These are read and written by various programs which may cause conflicts between users. Plus some of these files need to be accessible only by one user, otherwise the related program will refuse to work. It's better to create a subdirectory within one user's home directory that will be used by both users, and symlink that subdirectory in other user's home directory. Of course the subdirectory needs to be group writable by group admx and have the setgid bit set, so both users can create files within this directory and they will be automatically assigned to the group.
For convenience, you may put a
cd
command that changes to this subdirectory in each user's.profile
file, so after login both users will start in that subdirectory and not in their home directory.Despite the warnings in the first solution I have played a bit with symlink after I read this keyword.
One might do it like this:
Suppose both administrators
adm1
andadm2
are in the same groupadmx
. Suppose/home/adm1
is the home directory ofadm1
and it is properly configured. No work has to be done to provideadm2
with reasonable settings, since his directory will be replaced by a softlink to/home/adm1
:The last two step are necessary because
adm2
is not owner of/home/adm1
.The advantage of this solution - albeit more complicated compared to the solution above - is that it avoids duplicating
./config
(not mentioned there) to the other administrator's home directory such that both enjoy the same settings. The second administrator gets all his power through the groupadmx
. The SGID bit set at the end makes sure that subsequently created directories below/home/adm1
also inherit groupadmx
.