Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,786
Rep:
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.