coping users and resetting passwords in solaris

Posted on 2006-05-30
Last Modified: 2013-12-27
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.

Question by:jomfra
    LVL 14

    Expert Comment

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

    LVL 38

    Expert Comment

    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.

    Author Comment

    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.
    LVL 38

    Accepted Solution

    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!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
    A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now