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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ssh in a shell script without the use of key pairs 2

Status
Not open for further replies.

Subel

Technical User
Oct 24, 2008
3
0
0
NL
I'm attempting to use ssh in a shell script to connect to a tape device. But it requires someone to enter the password. Is there a way to set it up in a similar manner so that it gets the password without human intervention?

The use of key pairs is no an option because the tape device does not support it.

Please who will help me out?

Kind regards,
Joop Subelack
 
Last but not least, expect is also not an option, because it is not allowed on our unix server ;-(
 
Does the tape drive side support .shosts or shosts.equiv or even .rhosts?
 
No the tape drive side does not support unix options.
After loggingin to the device there is only a small set of commando's like "getstatus" or "showversion"
 
Can you build openssh? Then (hack on) you can embed or add the an option to pass the password in the userauth_passwd
routine, either by hardcoding it or getting it from a file or config.
 
Use Perl, Ruby, C++ or sshpass.

sshpass can pass the password to the ssh command.
Perl and Ruby you can specify the password in the script
C++ you can write a little program to take care of the ssh portion.

Perl SSH Example:

Ruby SSH Example:

SshPass Info:

C++ Lib:

I'd not recommend using the C++ approach unless you know or are wanting to learn c++. It's something I've been playing with recently! :)

As a side note, you maybe able to get the information using snmp polling the tape device.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top