The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to change password? ipzig Post Here to Contact Site Administrators and Moderators 6 05-27-2008 04:15 AM
change password ?? varungupta UNIX for Advanced & Expert Users 4 03-03-2008 12:25 PM
How I Can Change The Password bobangarcia HP-UX 4 10-06-2005 11:06 PM
Change password by pushing encrypted password to systems benq70 UNIX for Dummies Questions & Answers 1 09-02-2005 06:08 AM
can't change password hassan2 UNIX for Advanced & Expert Users 9 12-23-2003 03:05 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-07-2005
Registered User
 

Join Date: Sep 2002
Location: UK
Posts: 65
Automated Password Change

Hi All
I need to automate (execute from a script or loop on the command line) password changes on a number of UNIX boxes. I cannot use telnet since I have disabled this on all servers - and installed SSH.

I have root private/public keys setup so that I can login directly into the boxes non-interactively, hence I am looking for something like this:

ssh $hostname "/path/to/a/local/script"

Obviously that script can take username and password variables from a access restricted file on each host, or even specify these in the script itself. What I plan on doing is pushing the same script out to all servers and then executing it.

The problem is, as we all know, passwd is interactive, and I just cannot get it to read from stdin. I have tried:

passwd $username<<EOF
password
password
EOF

But this does not work.

The reason I need to use passwd is because the boxes are installed with a variety of UNIXes, so I need something that will work universally, and not something that relies upon OS specific tools.

Any ideas? Or anyone have any better ways to do this ( bearing in mind the solution must be cross-platform friendly).

Any help is much appreciated.
__________________
Free Palestine
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-07-2005
Registered User
 

Join Date: Dec 2004
Location: Zürich
Posts: 146
you can try installing webmin on all unix boxes. webmin has a module for this type of thing, and many others. it's easy to use & install.

http://www.webmin.com
Reply With Quote
  #3 (permalink)  
Old 01-07-2005
Registered User
 

Join Date: Sep 2002
Location: UK
Posts: 65
As far as I am aware, Webmin doesn't have the ability to change the passwords on a remote server, does it?

I need two functional criteria to be met:

1. Something that can be executed from a central location.
2. Something that can change passwords non-interactively.
__________________
Free Palestine
Reply With Quote
  #4 (permalink)  
Old 01-07-2005
Registered User
 

Join Date: Dec 2004
Location: Zürich
Posts: 146
webmin has a cluster change password module standard with version 1.170 but you need to have webmin installed on all machines and configured in a cluster, meaning all listening on port 10000 and tell webmin it's in a cluster. if you have webmin running in a cluster you can execute some commands from a central location like change passwords, copy files, cron jobs, shell commands, users and groups, install software and webmin configuration. maybe some third party modules have extra functionality. check out the webmin site in their standard modules.
Reply With Quote
  #5 (permalink)  
Old 01-07-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,334
Sometimes the only way to a portable script is something like:
Code:
os=`uname -s`
case $os in
HP-UX)
           hp-ux code
            ;;
SunOS)
           sunos code
            ;;
*)     
            echo unsupported os  >&2
            exit 1
            ;;
esac
Since the script is running as root, it can do anything. So replace the encrypted password string in /etc/password or /etc/shadow as required.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0