SFTP connection works from Windows (WinSCP) but not from Linux, why?

I'm trying to connect to a remote linux server using a public key (it's not my server). I was given the public key and verified that I can connect just fine using WinSCP from a PC. However, the real goal is to automate and script the connection from a RHEL 7.5 box. Every time I try to connect from Linux, I immediately get "Connection Refused".

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 67: Applying options for *
debug2: resolving "ftp.server.org" port 333
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to ftp.server.org [x.x.x.x] port 333.
debug1: connect to address x.x.x.x port 333: Connection refused
ssh: connect to host ftp.server.org port 333: Connection refused
Couldn't read packet: Connection reset by peer

I get the same error if I try via SSH.ssh -i /data1/security/sftp/xxxx.key -p 333 -vv

The only difference that I know of, is that when using WinSCP, it converts the public key file from an OpenSSL format to putty format.

Any ideas what is missing? I've never encountered this before.

6

1 Answer

When you read this :

debug1: connect to address x.x.x.x port 333: Connection refused
ssh: connect to host ftp.server.org port 333: Connection refused

That means you can not establish the TCP connection .

So that can be the firewall , or no daemon is listening on the server side , or you DNS resolution give you the wrong IP or unlikely from your location port 333 is filtered

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like