![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
#3
|
|||
|
|||
|
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
|
|||
|
|||
|
did you ensure a pseudo-terminal was allocated?
|
|
#5
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
Any ideas on why the password variable won't get passed on?
|
|||
| Google The UNIX and Linux Forums |