The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do i change to super user then revert back to ordinary user ,using shell script? wrapster Shell Programming and Scripting 3 06-04-2008 04:11 AM
rsh to change multiple ip in multiple servers? kenshinhimura Shell Programming and Scripting 2 02-18-2008 12:04 AM
login into multiple servers thru script... avcert1998 Shell Programming and Scripting 1 09-09-2005 12:38 AM
User add on multiple servers sandeep_pan Shell Programming and Scripting 6 06-10-2005 02:04 PM
Urgent !!! - Script to Change passwords in unix tofani SUN Solaris 2 09-16-2003 03:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-17-2005
Registered User
 

Join Date: Sep 2005
Posts: 4
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?
Reply With Quote
Forum Sponsor
  #2  
Old 01-18-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Would telnet work ?

Check this out - need script for passwd , can't use expect tool
Reply With Quote
  #3  
Old 12-13-2007
Registered User
 

Join Date: Aug 2006
Posts: 13
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.
Reply With Quote
  #4  
Old 12-13-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by stringzz View Post
I tried using ssh with the script above and it doesnt work.
did you ensure a pseudo-terminal was allocated?
Reply With Quote
  #5  
Old 12-13-2007
Registered User
 

Join Date: Aug 2006
Posts: 13
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
Reply With Quote
  #6  
Old 12-13-2007
Registered User
 

Join Date: Aug 2006
Posts: 13
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
Reply With Quote
  #7  
Old 12-18-2007
Registered User
 

Join Date: Aug 2006
Posts: 13
Any ideas on why the password variable won't get passed on?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:23 AM.


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

Content Relevant URLs by vBSEO 3.2.0