Operating System - HP-UX
1820879 Members
3965 Online
109628 Solutions
New Discussion юеВ

Re: Creating user account similar to other system

 
Venkat_11
Regular Advisor

Creating user account similar to other system

Hi,

I want to create a user account which i want to be similar like existing in one of our other servers. I want to create with same passwd ,username and home directory.
Can i copy the line from passwd file of that particular user account and can i add the same line by editing the password file on other server where i want to create user account by vipw command.
Advice me.

Thanks in Advance

Venkat
8 REPLIES 8
Pete Randall
Outstanding Contributor

Re: Creating user account similar to other system

Yes, you can. Make sure you create the home directory and assign proper permissions, too.


Pete

Pete
Rick Garland
Honored Contributor

Re: Creating user account similar to other system

Yes, this is doable.

Do make copies of the passwd file on each server just in case.
Steven E. Protter
Exalted Contributor

Re: Creating user account similar to other system

Shalom,

This approach can work on non-trusted systems. I would think there might be issues with the encryption algorythim on the password, but you should test it.

What about LDAP/NIS server?

That would simplify matters.

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
Venkat_11
Regular Advisor

Re: Creating user account similar to other system

after copying the lines from one server and edited the other server passwd file with vipw...and after that i created directory under /home and tried to change the permissions of that directory by using command

chown test:users test
but i observed test is getting some else user ownership of the same users group

Any suggestions to change ownership

Thanks
Venkat

Rick Garland
Honored Contributor

Re: Creating user account similar to other system

Check the UID numbers of those accounts. Make sure the UIDs are unique.

HGN
Honored Contributor

Re: Creating user account similar to other system

Hi

Hope the posting by others have helped in fixing your problem but you have not given any feedback to any of theanswers,people here spend time helping you out.

Rgds

HGN
James R. Ferguson
Acclaimed Contributor

Re: Creating user account similar to other system

Hi:

You wrote, "after copying the lines from one server and edited the other server passwd file with vipw...and after that i created directory under /home and tried to change the permissions of that directory by using command".

UNIX doesn't care about the login *name* as you supply it to 'chown'. What counts is the *uid* or the numeric user ID of the account. If you cut-and-pasted the whole line from the '/etc/passwd' file on the "source" server into the '/etc/passwd' file on the "destination" server then you may have duplicated a *uid* value. You need to make it unique.

Regards!

...JRF...
Paul Sperry
Honored Contributor

Re: Creating user account similar to other system

I strongly sujest re-creating the users
using the password file on the other server
as input.

cat passwd.from.other.server |while read line
do
USER=$(echo $line|awk '{FS=":";print $1}')
PASS=$(echo $line|awk '{FS=":";print $2}')
USERID=$(echo $line|awk '{FS=":";print $3}')
GID=$(echo $line|awk '{FS=":";print $4}')
INFO=$(echo $line|awk '{FS=":";print $5}')
HOME=$(echo $line|awk '{FS=":";print $6}')
SHELL=$(echo $line|awk '{FS=":";print $7}')
echo "Adding $USER"
useradd -u $USERID -g $GID -s $SHELL -c "$INFO" -o -d $HOME -m -k /etc/skel $USER
/usr/sam/lbin/usermod.sam -p`echo "$PASS"` $USER
done


The useradd command should be all on one line