Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shortening ssh commands in ksh 2

Status
Not open for further replies.

pdtak

Technical User
Feb 25, 2008
63
US
Is there a way to shorten these commands? because this script asks for a password 3 times

scp -p /usr/local/bin/${script_name} ${servername$iy]}://usr/local/bin/
ssh ${servernames[$iy]} /usr/local/bin/${script_name}
ssh ${servernames[$iy]} rm -f /usr/local/bin/${script_name}

Basically, I'm creating a script within a script, pushing it out to a server, execute it, and then removing it.

Thanks in advance.
 
man ssh-keygen

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Whilst I totally agree with feherke and PHVabout using public key authentication you can get round the copy - run - delete cycle by running
Code:
ssh ${servername[$iy]} < /usr/local/bin/${scriptname}
YOu'll get an error message which looks like
Code:
Pseudo-terminal will not be allocated because stdin is not a terminal.
this can be suppressed with
Code:
ssh ${servername[$iy]} < /usr/local/bin/${scriptname} 2>/dev/null
but you'll lose any other error messages

On the internet no one knows you're a dog

Columb Healy
 
Pseudo-terminal will not be allocated because stdin is not a terminal
Use the -t option.
 
For some reason the -t option didn't seem to work for me. From my AIX system
Code:
b01301# oslevel -r
5100-07
b01301# ssh -V
OpenSSH_3.8.1p1, OpenSSL 0.9.6m 17 Mar 2004
b01301# cat /tmp/col080303
date
uname -n
b01301# ssh -t b05401 < /tmp/col080303
Pseudo-terminal will not be allocated because stdin is not a terminal.
Mon  3 Mar 10:54:56 2008
b05401


On the internet no one knows you're a dog

Columb Healy
 
And I need to read the man pages more - nice one PHV

On the internet no one knows you're a dog

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top