Solaris : How to create user on remote server

Rick Stevens ricks at nerd.com
Fri Nov 27 18:57:05 UTC 2009


On 11/27/2009 10:43 AM, alok pandey wrote:
> HI Guru's
> I didn't find any reply from your side, should I assume that we can't
> create user a/c (id + password) on solaris, remotely through script ?
> I simply want to add a user a/c or in other word, I want to assign
> password to a user ,  remotely through ssh !

You can do a useradd command via ssh without problems, but when you set
a password for a user using the "passwd" command, it is an interactive
operation and you'd need to run something like "expect" to do it.

I'm not sure about Solaris, but the Linux "useradd" command permits you
to set the password using the "-p" option.  Note that the password given
as the argument to "-p" MUST be the ENCRYPTED version of the password
(not the cleartext), and it only supports the crypt(3) (DES) encryption.
If you use MD5 or stronger passwords, then you're sorta stuck.

Have a look at the man pages for expect for some ideas on how to
automate the interactive passwd command.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer                      ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-  Memory is the second thing to go, but I can't remember the first! -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list