1821071 Members
2724 Online
109631 Solutions
New Discussion

Home dir for users

 

Home dir for users

Home dir for users

--------------------------------------------------------------------------------

Hello all,

Most of our users have the same home directory, I know it’s weird but it has been like this before me and we don't want to change that for now. When creating a new user using command useradd, it is not allowing me to create it because it is using the home directory of someone else. I do use this command under a script :

/usr/sbin/useradd -g $GRO -d $HDIR -s /usr/bin/ksh -c "$FISRTNAME $NAME" $USE

Variables works fine...actually if I chose another home dir it is working fine. Just when 2 users have the same home dir. I know that you can go under SAM and change it, but still if you do that, the home dir will become own by the new user... I don't want that. So the other option is vipw the password file and change it manually... you also understand that I don't want that too. I thought about using sed to make the change in the password file using the script...but hummm ..no so sure if it is a good thing to do... any idea?

HP-UX 11.23
1 REPLY 1
Ivan Krastev
Honored Contributor

Re: Home dir for users

From manpage of useradd :

"WARNINGS
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.
"

I think you should use same group for all users.

regards,
ivan