SUMMARY: SSH and passwd

From: Wilkinson, Daniel (
Date: Tue Oct 10 2000 - 04:02:36 CDT


Thanks for the swift response. As most of you told me, use expect. Now
I've got to install this on a number of machines, so I tried to cheat, and
it worked...

1) Download the entire expect and tcl distributions from sunfreeware and
2) copy /usr/local/bin/expect out of the way somewhere safe, and
/usr/local/lib/tcl8.0/init.tcl too
3) uninstall the software
4) copy the above 2 files back into the correct places on all xxx servers
that I will need to remotely change passwords on (thus saving me having to
install loads of freeware all over the place)
5) create this script and copy to all servers:
#!/usr/local/bin/expect -f
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd

set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof

Then ssh servername scriptname &user $password


Thanks to:

Keith Clay
Aaron Laffery
Dan Brown (Sorry for sending you that short sharp note)


PS. Darren Mcrae - If I get one more sarcastic comment about using
Superdomes instead of starfires, I'm coming round your desk to slap you.

PPS. Thanks to everyone else who came up with more or less the same
solution after I first posted a summary (it never arrived)

On Friday, October 06, 2000 2:35 PM, Wilkinson, Daniel
[] wrote:
> Hello again
> Yes, the passwd program is fine, if I do passwd -sa or something, it works
> etc. I am thinking that It is because you cannot script a passwd change -
> no matter how you are logged in. Someone please prove me wrong and show
> how to script a passwd change. (No, NIS, or anything, ust standard passwd)
> Thanks
> Dan
> -----Original Message-----
> From: Wilkinson, Daniel
> Sent: 06 October 2000 21:02
> To: 'sun'
> Subject: SSH and passwd
> Admins,
> Is it possible for me to change a passwd (yes, roots...) remotely via
> I have the software installed and set up for remote ssh, and it works
> I can happily wander around removing files owned only by root etc without
> problems. But if I try to run passwd, I get permission denied. Is this
> some 'extra' security feature of SSH? If so, how do I turn it off?
> Thanks
> Dan
> (PS - using the distribution from, not .org, if there's a
> difference)

U BEFORE POSTING please READ the FAQ located at
. and the list POLICY statement located at
A To submit questions/summaries to this list send your email message to:
A To unsubscribe from this list please send an email message to:
E and in the BODY type:
R unsubscribe sun-managers
S Or
. unsubscribe sun-managers original@subscription.address
L To view an archive of this list please visit:

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:19 CDT