moving users from one box to another

Hello. I am a newbie admin. I need to migrate about 20+ users from an existing solaris box to another. I am wondering if I can just copy the user's in question /etc/passwd entries on one machine to the other?

Will their password remain the same? What about their home directories how do I re-create those?

I've been using 'admintool' in the past to create users.

[392 byte] By [awolff01] at [2007-11-25 23:39:47]
# 1
You will also need the user's entries from the /etc/shadow file. You can create the home directories manually (you said there were only 20)
sgtrock at 2007-7-5 18:47:44 > top of Java-index,General,Talk to the Sysop...
# 2

YOU ARE USING A GUI? Shame on you :)

..as the guy before me said before me, don't forget to grab /etc/shadow. That's where your passwords are... if you are adding those users to the new machine, do not forget to save both the /etc/passwd and /etc/shadow that you are updating. If not, copying both passwd and shadow to the new box should be ok...

...also, don't forget /etc/group, if you have any non-default groups added in the older box.

..as for creating the 20 directories, you can actually just tar them up and move them to the new box after adding the users.

Or, since you are new to admin stuff, let me show you a quick way to make the directories using the command line:

I assume that your user directories are named as their owners' login and that they all are in the same parent directory, say /export/home? Asuming that the home directories are in /export/home, that all your users are part of the staff group, and that you have no aliases for the ls command:

In the old machine, do:

# ls /export/home >> dirs.txt

transfer dirs.txt to the new server, and put it in, say, /tmp. After adding the users in the new box, as root do this:

# ksh

# for x in $(cat /tmp/dirs.txt ); do

> mkdir /export/home/${x}

> chown ${x}:staff /export/home/${x}

> done

Codename47 at 2007-7-5 18:47:44 > top of Java-index,General,Talk to the Sysop...
# 3

... forgot to add:

the # ksh is there because I routinely chance my root's login passwd to ksh, and I do all my scripting on ksh... not that the default root's shell wouldn't read a loop, but it doesn't understand some of the syntax in ksh which I prefer. sh will not understand $( ) as command substitution, for example... after you are done, just type exit and you'll be back in your regualr root shell.

... you can actually use a loop like that one to add your users to the new box without manually editing your /etc/passwd and /etc/shadow and having to create directories by looping the useradd command... the only tricky part is that you have to enter different userID's, but it is not that hard. You just need to add a counter ... it would look something like this:

# ksh

# COUNT= 1001 # or whatever number you want to start with

for x in $(cat /tmp/dirs.txt ); do

> useradd -u${COUNT} -g10 -d/export/home/${x} -s/usr/bin/ksh ${x}

> let COUNT=${COUNT}+1

> done

..there are other factors that you'd need to consider; for example, if you want to keep the original userID's because you are transferring files, or if the users belong to groups other than staff, or if the users are using different shells, etc... actually it wouldn't be that hard to get all the info from the old machine in 1 file, then use that 1 file to recreate everything in the new box..

..these are just but a few examples to show you what you can do with the command line, which is one of the powers of Unix.

Codename47 at 2007-7-5 18:47:44 > top of Java-index,General,Talk to the Sysop...