LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   change password in one go (https://www.linuxquestions.org/questions/solaris-opensolaris-20/change-password-in-one-go-647747/)

vikas027 06-08-2008 04:12 AM

change password in one go
 
Hi all,

I need to change the password of any user in one go.

For example in Linux we have two options :-

Code:

(echo "username:password") | chpasswd
or
echo $PASS | passwd $USER --stdin

This changes the password without prompting. Actually, I need to make a script which adds a user and then sets a password to it.

I have made it for Linux but now I require it to run on other Unix boxes also. I dont have option to install any other utility like expect. :cry:

Pls can someone give Solaris equivalent of the command.

Thanks in adv.

VIKAS

ehawk 06-08-2008 05:12 AM

http://www.ussg.iu.edu/usail/man/solaris/passwd.1.html

In files case, super-users (for instance, real and effective
uid equal to zero, see id(1M) and su(1M)) may change any
password; hence, passwd does not prompt privileged users for
the old password. Privileged users are not forced to comply
with password aging and password construction requirements.
A privileged user can create a null password by entering a
carriage return in response to the prompt for a new pass-
word. (This differs from passwd -d because the "password"
prompt will still be displayed.)

http://www.informit.com/articles/art...26523&seqNum=6

Root and Password Changes

The root user is permitted to change the password for any user. When root changes a user's password, the passwd command does not prompt for the old password. This permits root to "reset" a user's password in circumstances when the user has forgotten his or her password. This also permits root to lock a user's account by changing the user's password to a value that the user is unlikely to guess.

jlliagre 06-08-2008 05:13 AM

Use a network based user/password management like NIS or LDAP and you are set.

See also: http://www.linuxquestions.org/questi...prompt-646675/

ehawk 06-08-2008 05:29 AM

From:

http://www.fantasticunix.com/forum/g...assword-2.html

This seems to be a little difficult because of the lack of useradd

ehawk 06-08-2008 05:48 AM

Check out the perl script on this page:

http://aa11.cjb.net/sun_managers/1998/10/msg00411.html

Also, see:

http://www.softpanorama.org/Utilities/chpasswd.shtml

reddazz 06-08-2008 03:38 PM

I've merged similar threads. vikas027, please avoid posting the same question in multiple threads.

ehawk 06-08-2008 10:16 PM

Well, I can kinda understand...they are posted to different forums (solaris, hp-ux, aix)...people might ignore one and comment on another based on their knowledge/experience...covering bases...if he posted to a single, more general forum, poweruses with the respective OSs might bypass it altogether. Very similar, true, but wasn't a "bad faith" of multi-posting, I don't think (reasonable explanation exists).

vikas027 06-09-2008 12:29 AM

Quote:

Originally Posted by reddazz (Post 3178564)
I've merged similar threads. vikas027, please avoid posting the same question in multiple threads.

I did so because all belong to different OS.

still, will take care in future.

ehawk 06-09-2008 01:09 AM

If you have not found a solution yet, consider posting to justlinux.com

ehawk 06-09-2008 01:10 AM

If you have not found a solution yet, consider posting to justlinux.com

Also, I would guess that there are dedicated solaris, hp-ux, and aix help sites/forums

vikas027 06-09-2008 04:59 AM

Thanks ehawk, will post there too.


All times are GMT -5. The time now is 02:52 PM.