SSH Connection

Will McDonald wmcdonald at gmail.com
Thu Jun 2 15:21:18 UTC 2005


Your best bet would probably be to use key-based auth...

http://www-106.ibm.com/developerworks/library/l-keyc.html
http://www-106.ibm.com/developerworks/library/l-keyc2/
http://www-106.ibm.com/developerworks/library/l-keyc3/

http://www.gentoo.org/proj/en/keychain/index.xml (Available for most
RH variants from the DAG repositories
http://dag.wieers.com/home-made/apt/ )

Read through those articles to get a decent understanding of how it
works then generate a key-pair on box A, preferably including a
passworded private key!

Then copy the public key into $HOME/ias/.ssh/authorized_keys on box B.
Make sure authorized_keys has 600/rw------- permissions.

Finally use keychain to cache local authentication information on box
A, preferably using the --clear option when you source it from
bash_profile or wherever. You probably want to source

$HOME/.keychain/$HOSTNAME-sh

from within your script too.

Will.

On 6/2/05, Kelley.Coleman at med.va.gov <Kelley.Coleman at med.va.gov> wrote:
> I would like to run a script on box A that connects to box B, executes a
> script there, then returns to complete the original script.  The user
> accounts are different on each box.  Box A user is 'oracle', box B user is
> 'ias'.
> 
> I tried:
> 
> ssh servername -l ias /u01/ias/scripts/test_script.sh
> 
> but I'm prompted for a password.
> 
> I tried putting the password into the script where it seems to want it, but
> again, I'm prompted for a password and it processes the password in the
> script as a command.
> 
> Do I need to do something in the ssh_config?  known_hosts? authorized_keys?
> 
> I'm not thrilled with the thought of having the password in a script file.
> So if there's a better way, I'm all for hearing it!
> 
> Thanks in advance...




More information about the redhat-list mailing list