Operating System - Linux
1827399 Members
4915 Online
109965 Solutions
New Discussion

2 users with same home dir

 
Ragni Singh
Super Advisor

2 users with same home dir

Hello, is it possible to have 2 users with the same home directory.

THis is the current user..

crmuser:x:24800:440:CRM ftp id - home/ftp/./crmuser:/bin/false

I need to create another user but with the same home dir.

THe folks are trying to run some ftp jobs but the problem is noone seems to know what the password is fo that user and that person is no longer around. I'm worried if I chnage the password, we could break some scripts if passwords are hard-coded.

We would just like to be able to create another user but with the same home-dirs as the crmuser.

Thanks and points will be assigned.
5 REPLIES 5
Nuwan Alwis
Valued Contributor

Re: 2 users with same home dir

Hi
Sharing a HOME directory can be done.
Only thing you need to do is make new user account attached to the same group of the old user.
eg:
vi /etc/passwd

ftp1:x:1003:1003::/home/ftpuser1 //Old user
ftp2:x:1004:1003::/home/ftpuser1 //new

note i have used same gid for new user as in old users gid which makes both new and old user both same group

may be you have to alter home folder permission if its on 700

Good Luck...!
Steven E. Protter
Exalted Contributor

Re: 2 users with same home dir

Shalom,

Sure you can stick two users in the same home directory.

To keep permissions from being wildly open, they need to both be in the same group, gropu 440.

Then set the umask to permit group write on new files created.

You may need to modify files in the home directory so that both users can change them.

As to breaking scripts with hard coded passwords. Yes, you will break these scripts. This is not a best practices setup anyway.

You can try something else.

Public key exchange ssh, which would permit these users to log on as each other without a password.

http://www.hpux.ws/?p=10

The second user can gain access to all of crmuser data and essentially be crmuser when needed by script. I don't know if that meets the requirements, you really don't post requirements.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
dirk dierickx
Honored Contributor

Re: 2 users with same home dir

you can do that, however it's not a very clean/secure implementation.

let this be a lesson also for having documentation and/or a password database for important id's.

also consider cracking the unknown password of the user with 'john the ripper' or the likes;

http://www.openwall.com/john/
Mike Stroyan
Honored Contributor

Re: 2 users with same home dir

Rather than adding a different user you could edit /etc/sudoers and add permission for specific users to sudo to the crmuser.
Then
sudo -i -u crmuser
would allow one of those users to get a shell as crmuser.
Dennis Handly
Acclaimed Contributor

Re: 2 users with same home dir

You could also create another user name but with the same ID.