Automated Password Change


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Automated Password Change
# 1  
Old 01-07-2005
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.
# 2  
Old 01-07-2005
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
# 3  
Old 01-07-2005
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.
# 4  
Old 01-07-2005
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.
# 5  
Old 01-07-2005
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Password sent via reset password email is 'weak' and won't allow me to change my password

I was unable to login and so used the "Forgotten Password' process. I was sent a NEWLY-PROVIDED password and a link through which my password could be changed. The NEWLY-PROVIDED password allowed me to login. Following the provided link I attempted to update my password to one of my own... (1 Reply)
Discussion started by: Rich Marton
1 Replies

2. AIX

Change password to blank password

AIX 6.1 User has a password set. It needs to be a blank password (no password). smit passwd enter user name at change password and confirm password, just press ENTER Afterwards, I could not log on with blank password or with original password. How can I change the password to a... (2 Replies)
Discussion started by: landog
2 Replies

3. UNIX for Dummies Questions & Answers

Help with Password Change

When I am trying to change the password of my account. I could see the following error: passwd: Changing password for ramu Enter existing login password: passwd: Sorry: less than 14 days since the last change. Permission denied Is anybody out there who can help me in changing my password? (4 Replies)
Discussion started by: bobby1015
4 Replies

4. Shell Programming and Scripting

Automated FTP without plaintext user/password in script

hi , i am a still beginner in unix and specially in ftp i've written this script but my admin asked me that he don't want to see in my ftp neither user neither password , so i've created .netrc file where in it i've put machine name , user and pass but still included in my script , so if someone... (19 Replies)
Discussion started by: semaan
19 Replies

5. UNIX for Advanced & Expert Users

Automated SCP script passing password to preserve source file timestamp

Hi My requirement is i want to copy files from remote server to the local server and also i need to preserve the timestamp of the remote file. By using scp -p , it is working fine in the interactive call but it is not preserving he file timestamp when i use it in the non interactive scp call... (1 Reply)
Discussion started by: skumar75
1 Replies

6. Solaris

Solaris 8 - Asks for current root password when trying to change root password.

Hello All, I have several solaris boxes running Solaris 8. When changing root passwords on them, all will simply ask for the new root password to change and of course to re-type the new password. One of the systems however asks for the existing root password before it will display the new password... (8 Replies)
Discussion started by: tferrazz
8 Replies

7. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

8. Shell Programming and Scripting

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 :- (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... (5 Replies)
Discussion started by: vikas027
5 Replies

9. UNIX for Dummies Questions & Answers

Change password by pushing encrypted password to systems

I'm tasked to change a user's password on multiple Linux systems (RH v3). I though copying the encrypted password from one Linux /etc/shadow file to another would work but I was wrong. The long term solution is to establish an openLDAP Directory service, but for now I'm stuck with a manual... (1 Reply)
Discussion started by: benq70
1 Replies

10. UNIX for Advanced & Expert Users

can't change password

I have just upgraded one on my solaris 8 machine to solaris 9 the upgraded went fine and user have loging on successfully and authenticated user logon on nis successfully. My Nis master runs on solaris 8. my solaris 9 machine is configure as a Nis client and authenticated user successfully but... (9 Replies)
Discussion started by: hassan2
9 Replies
Login or Register to Ask a Question