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!

an automated ssh shell script to connect to remote system

Status
Not open for further replies.

keak

Programmer
Sep 12, 2005
247
CA
I found a method to do this with Net::SSH::perl but I need to do this with a shell script ....
say if i have the following ifo
host: apple
user: test
pw: test
and I wanted to login to this apple and upload a textfile called "test.txt" from my local system to it, can I do it with a shell script ?

Any input will be much appriciaed,
Thanks
 


Use secure copy scp or remote copy rcp:

scp test.txt test/test@apple

[sleeping2]

PS: man scp

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Thanks for the help LKB :)
I actually figured it out, but yeah scp was a good option if I wanted to do only file uploading.

Basically what I did was to setup a ssh pub key so that host A didn't reuqire a password for ssh to host B

Then I wrote the following script in host A (it was actually super short.....)

#!/bin/sh
ssh (your host name here) <<END_SCRIPT
ls
mkdir test dir
(any other commands you want)
exit
END_SCRIPT
exit 0



Just in case anyone nedded to do the same thing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top