script to change passwords for the same user on multiple servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to change passwords for the same user on multiple servers
# 1  
Old 09-18-2005
script to change passwords for the same user on multiple servers

I am trying to write a script to change passwords for the same user on multiple servers.

My environment runs purely ssh / scp not rsh / rcp and therefore coping using rcp is not an option.

I have been playing with expect to perform tasks but think there must be a better way.

Has anyone got any ideas to help me out?
# 2  
Old 01-18-2006
Would telnet work ?

Check this out - need script for passwd , can't use expect tool
# 3  
Old 12-13-2007
I need to change my unix password over 10+ servers. I am not an SA, just a user. I am on Solaris 10 using ksh. I would like a script that runs through a host list and changes the password.

The script above is great, but we are not allowed to use telnet here at work. We have to use ssh to get into another server. I tried using ssh with the script above and it doesnt work. I can't use third party utilities. Any ideas would be greatly appreciated.
# 4  
Old 12-13-2007
Quote:
Originally Posted by stringzz
I tried using ssh with the script above and it doesnt work.
did you ensure a pseudo-terminal was allocated?
# 5  
Old 12-13-2007
I get this message when it connects to the new server
"Pseudo-terminal will not be allocated because stdin is not a terminal."

So how do I allocate the Pseudo-terminal? And if I do it, will the script run in your opinion?

Thanks
# 6  
Old 12-13-2007
I actually found out how to force psuedo terminal

ssh -T

So, now the code seems to work up until it trys to pass the $OLDPASS variable. It just sits there at the password prompt on the remote server

Code:
#
#  Section 1 --- Prove that we can talk with the hosts in HOSTLIST
HOSTLIST="myserver.net"
DELAY=3
stty -echo
print -n Enter Old Password-
read OLDPASS
print
print -n Enter New Password-
read NEWPASS
print
stty echo
USER=$(whoami)
exec 4>&1


#
#  Section 1 --- Prove that we can talk with the hosts in HOSTLIST
#     Part 1 --- telnet to each and touch a file

for HOST in $HOSTLIST ; do
        ssh -T $HOST >&4 2>&4 |&
        sleep $DELAY
        ##print -p $USER
        sleep $DELAY
        print -p $OLDPASS
        sleep $DELAY
        print -p touch changepassdatafile.$HOST
        sleep $DELAY
        print -p exit
        wait
done

# 7  
Old 12-18-2007
Any ideas on why the password variable won't get passed on?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script To Delete User Accounts On Multiple Servers

Hello All, The servers in question are AIX/Unix servers. I was hoping to find a scripting solution where I could use one server as a jump server and run a script that would check each server for a user account (the source file for the user accounts would be a text file or csv file) , and delete... (4 Replies)
Discussion started by: k45bryant
4 Replies

2. Shell Programming and Scripting

Shell script to ssh and change the passwords

Hi All, I am trying to create a script with the help of while and expect loop to do the following: 1. script will pick up the servers one by one from server_list file and will do ssh to it. 2. for each server it will change the password of user test1. 3. script should also provide logs for... (1 Reply)
Discussion started by: omkar.jadhav
1 Replies

3. Shell Programming and Scripting

How to change passwords for User accounts on multiple UNIX/Linux machines remotely?

Hello Experts, Need some direction on creating shell script for following environment: We have about 20 people in the team working as Oracle DBA's (sysdba's and appdba's). Total Servers which is a mix of Unix and Linux are 200. We do not have Root user access on any of the servers and... (3 Replies)
Discussion started by: sha2402
3 Replies

4. UNIX for Dummies Questions & Answers

Unable to change domain user passwords

Hi, I'm new to this site, so my apologies if this is posted to the wrong board. I'm the student administrator of a small computer science lab (20 Win 7 PCs) at a university. The logins to the PCs are handled by samba (v. 3.5.8) on a CentOS server (kernel v. 2.6.9-100.ELsmp). Recently I ... (1 Reply)
Discussion started by: kerona
1 Replies

5. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

6. UNIX for Dummies Questions & Answers

Change user passwords using shell script

Hi, I want to change the password of unix users on a number of servers.My plan was to ssh to all the servers in a shell script and use the passwd command. I tried to do so but everytime i run it i get this error. ssh -x -n -l user1 host passwd Changing password for "user1" 3004-709 Error... (3 Replies)
Discussion started by: poojabhat
3 Replies

7. Shell Programming and Scripting

Prevent wrong user from using shell script for multiple remote servers

Hi, I am running a shell script from a central server to multiple remote servers using the following code: application_check() { # Linux/UNIX box with ssh key based login SERVERS=`cat /tmp/server-details` # SSH User name USR="user" # create new file > /tmp/abc.log # connect... (2 Replies)
Discussion started by: mystition
2 Replies

8. Shell Programming and Scripting

user id creation of multiple servers

Need help in creating a user with passord in mulptiple solaris servers using a script.. (0 Replies)
Discussion started by: ningy
0 Replies

9. Shell Programming and Scripting

rsh to change multiple ip in multiple servers?

good day. i jsut wanted to know what is the best script or the best way changing a lot of Ip's in all servers. Do you have any idea? im using awk to change IP,what if, you have lots of servers. You need to change it one by one? It will take time to change it manually. (2 Replies)
Discussion started by: kenshinhimura
2 Replies

10. Solaris

Urgent !!! - Script to Change passwords in unix

I have SunOs 5.8. I need to change password using a unix shell script. I have tried to pipe the passwords to the passwd command but does not work. Pls provide a script to change passwds of a list of users using a shell script. ( I have also tried crypt() but did not work) The flow of the... (2 Replies)
Discussion started by: tofani
2 Replies
Login or Register to Ask a Question