LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-25-2002, 09:48 PM   #1
gopi_20us
LQ Newbie
 
Registered: Feb 2002
Posts: 9

Rep: Reputation: 0
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.
 
Old 02-26-2002, 07:34 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
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
 
Old 02-26-2002, 08:09 AM   #3
gopi_20us
LQ Newbie
 
Registered: Feb 2002
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks MIK it worked .

Hi MIK,

Thanks for all your help.It worked .
 
Old 02-26-2002, 11:03 PM   #4
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
If you have ncftp installed, it comes with command line versions.

ncftpget and ncftpput.
 
Old 03-01-2002, 04:04 PM   #5
kervin
Member
 
Registered: Jan 2002
Location: Melbourne, FL.
Distribution: redhat
Posts: 168

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
ssh_exchange_identification: Connection closed by remote host piter23 Linux - Software 17 09-11-2013 09:59 AM
Remote connection UNKNOWN host scoban Linux - Networking 2 07-14-2005 10:09 AM
rndc: connection to remote host closed. james.farrow Fedora 2 06-16-2004 11:40 AM
ssh_exchange_identification: Connection closed by remote host ctav01 Linux - Networking 1 08-22-2003 07:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration