Solaris / OpenSolarisThis forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Yes, the usual way to do it is by using an expect script. You'll have to install expect as it isn't part of Solaris though.
Alternatively, now that Solaris in open sourced, nothing forbids you to build your custom patched version of passwd http://src.opensolaris.org/source/xr...asswd/passwd.c and add the feature by calling a custom getpassphrase call.
jlliagre,
Thanks for your reply.
I tried that one on linux machine and it worked. I am in process of installing solaris 10 in VMware and check the same.
Also, I agreed with your comment for working with shadow file, But I want to sync passwords between multiple servers using script only. In my environment it is not possible to implement NIS/LDAP.
I am replying to vikas with example script. Please update if anything is wrong.
vikas027,
Sample Shell Script:
Code:
#!/bin/bash
echo "Enter Username:"
read USER
echo "Enter New Password:"
read NEWPASS
/path/to/perl changepasswd.pl $USER $NEWPASS
Sample Perl Script:
Code:
#!/usr/bin/perl -w
use Passwd::Unix;
my $pu = Passwd::Unix->new();
$pu->passwd($ARGV[0], $pu->encpass($ARGV[1]));
Please install Passwd::Unix perl module first.
You can enhance it with no. of users ( using for loop ) and error checking.
Please try it at your end and update.
Last edited by p_s_shah; 06-09-2008 at 08:07 AM.
Reason: Updated info
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.