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 [email protected]
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.