to connect to a SFTP site from a Red Hat server 'server A'  and fetch some files via a Router

Flex Tron
Flex Tron used Ask the Experts™
on
Dear Gurus,
I have a situation where I need to connect to a SFTP site from a Red Hat server 'server A'  and fetch some files.
There is a a dedicated lease line via a router (Router B) which can let me connect to this sftp site. (Server Site C)

I can do a telnet succesfully to the B from A at port 30206
telnet B 30206
#Successfully connected to B

Now we need to do a sftp pull.
I sent my Server A public keys and the guy says he has placed it in Site C


We don't own the router B but its part of our company network.

I tried

#sftp -oPort=30206 username@Site C

Open in new window


It asks for a password"

Not sure how can we connect to the Site C via router B
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 1: Applying options for *
debug1: /etc/ssh/ssh_config line 4: Deprecated option "rhostsauthentication"
debug1: /etc/ssh/ssh_config line 8: Deprecated option "fallbacktorsh"
debug1: /etc/ssh/ssh_config line 9: Deprecated option "usersh"
debug1: Connecting to emea1-bloomsftp.gslb.db.com [10.142.230.76] port 30206.
debug1: Connection established.
debug1: could not open key file '/etc/ssh/ssh_host_key': No such file or directory
debug1: could not open key file '/etc/ssh/ssh_host_dsa_key': No such file or directory
debug1: could not open key file '/etc/ssh/ssh_host_ecdsa_key': Permission denied

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
nociSoftware Engineer
Distinguished Expert 2018

Commented:
SFTP is not meant for batch use. scp is though.
Try if SCP does work there.

Another option is to try to use CURL which can  ( https://curl.haxx.se )  handle some of the processing.
Flex TronDeveloper

Author

Commented:
@noci
Thanks for the reply.
But actually I just wanted to know the syntax for connecting to a target server via a router
Did a SCP also and same issue...Its not connecting.


#scp -P 30206 username@Router B:/ .
#sftp -oPort=30206 username@Router B

Open in new window


doesn't connect to Site C .
Not sure if the command I am trying is correct ?
nociSoftware Engineer
Distinguished Expert 2018

Commented:
You cannot specify access via a router this way...
And this assumes the regular port 22 has been replaced with 30206 on the target.

You connect to the target system directly C?:
$ scp -P 30206 username@targetsystemC:/whateverfile ./
$ sftp -oPort=30206  username@targetsystemC 

Open in new window


The sftp / scp  service  needs to be setup on the target system though.
Telnet ports ARE NOT for use by sftp/scp . They are telnet only. If telnet is used as a testing tool if a port exists and does connect, that is OK.
(BTW, telnet is unsecured, and shows password to any network observer on the way between your system and the target system. )

ssh  ports can be used for ssh / sftp.    

For telnet ports try to use Kermit , zmodem to transfer files.
Developer
Commented:
The Solution we found is that teh Routers can be mapped to point to the Target host.
So we need to connect to teh router at a particular port and it should be able to connect to teh target host.
This is also known as the leased line approach.

SO teh command we did use was

#sftp -oPort=30206 username@Router B

Thanks for all your help.

Danke.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial