LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   remote host connection script question??? (https://www.linuxquestions.org/questions/programming-9/remote-host-connection-script-question-15072/)

gopi_20us 02-25-2002 09:48 PM

remote host connection script question???
 
Hi all,

How to connect remote host from a unix script.I know first use
ftp
and then use
open <host_name>
userid
<passwd>
Would you please confirm this is correct.

Thanks in advance.
Gopi.

Mik 02-26-2002 07:34 AM

Yes that is how you would connect manually. But if you just put those commands in the script it won't work. Ftp requests an automatic login which you disable with the -n switch. After that you have to redirect the script commands to the input of the ftp process. Try something like:

#!/bin/sh
# simple ftp script

ftp -n <<EOF
open servername
user username password
put filename
quit
EOF

gopi_20us 02-26-2002 08:09 AM

Thanks MIK it worked .
 
Hi MIK,

Thanks for all your help.It worked .

crabboy 02-26-2002 11:03 PM

If you have ncftp installed, it comes with command line versions.

ncftpget and ncftpput.

kervin 03-01-2002 04:04 PM

for security I'd suggest the scp program that comes with ssh. With ssh and scp you can setup public key authentication.


All times are GMT -5. The time now is 02:53 PM.