• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 293
  • 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

p.s QUESTION 1 NOT RELATED TO QUESTION 2
question 2 was forward to me by a friend and i am asking
on his insistance , will ensure he joints this forum.

thanks.
0
jomfra
Asked:
jomfra
  • 2
1 Solution
 
arthurjbCommented:
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...

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

/etc/passwd
/etc/shadow
/etc/group

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:
http://sunfreeware.com/

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.
0
 
jomfraAuthor Commented:
hello yuzh

how do i transfer the directories using tar
/etc/passwd
/etc/shadow
/etc/group

to the other server.
I do not know how to use "TAR"
Could you provide an example.
thank
0
 
yuzhCommented:
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,

eg:
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!

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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