• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

coping users and resetting passwords in solaris

Hello Expert,

Qestion number 1

I have a server (nbs-sun) running solaris 8
Recently i purchase  a workstation  and install solaris 10 (intel edition) B
I need to transfer about 50 unix users from NBS-SUN  to
new server B.

Can anyone provide a way to copy users?

Question number 2

Can the command
passwd -df (username)

be use for
multiple users?

example instead of resetting the password one user at time
is there any syntax or script that can  reset the passwords
for all the users

question 2 was forward to me by a friend and i am asking
on his insistance , will ensure he joints this forum.

  • 2
1 Solution
Its not fair to ask 2 questions in one.

As far as the first question is concerned, copy the /etc/passwd and etc/shadow to the new box.  (Since it is a different os version, you should actually just copy the users in the files and append them to the system accounts in the existing files, since Sun has tweaked the system users a little between 2.8 and 2.10)

You can make a tarball of the home directories on the the old server and copy that to the new box, where you can untar it and poof you're done...

if you want to make the system user accounts (incuding root) account the same, you need to copy:


files to the new box, otherwise, you can just cut and paste the user accounts
group details details and add to the new box.

To automatically reset the user file, you can download "expect" from:

then run autoexpect to create an expect script, modify the expect script to accep
user lognname and password as commandline args.

create a text file in with the following format:

user1 password1
user2 password2

then write another small shell script (sh/ksh script) to read the text file, and password
the loginname password to the expect script to do the job.

man expect
man autoexpect
to learn more

If you need help for modify the expect script, please post the one created by autoexpect, I (or other experts) will help you out.

also have a look at my answer in: http:Q_21513242.html

and example expect script http:Q_21277651.html...
run the script to read the file and set the password.
jomfraAuthor Commented:
hello yuzh

how do i transfer the directories using tar

to the other server.
I do not know how to use "TAR"
Could you provide an example.
to create the tar ball,

tar cvf myfiles.tar /etc/passwd /etc/shadow /etc/group

the use ftp/sftp transfer myfile.tar across

to extract files from myfiles.tar

tar xvf myfiles.tar

If you don't want to overwritten what's in the new box, use relative path to create the tar ball,

cd /
tar cvf myfiles.tar etc/passwd etc/shadow etc/group

transfer it to the new box and extract it under a tmp
dir eg /tmp

then cut and paste what you want from the files.

man tar
to learn more details.

Have a nice weekend!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now