HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting "Connection Refused" message when using sftp

 
SOLVED
Go to solution
Paul Maglinger
Regular Advisor

Getting "Connection Refused" message when using sftp

Running 11.23. Trying to connect to remote server using sftp. when I try, I get the following:

#sftp sftp.domainname.com
Connecting to sftp.domainname.com...
ssh: connect to host sftp.domainname.com port 22: Connection refused
Connection closed

I can perform the same command from my Windows workstation and at least get a login prompt. I don't have HIPS or firewall configured on this server. sshd is running. Thoughts anyone?
35 REPLIES
Steven Schweda
Honored Contributor

Re: Getting "Connection Refused" message when using sftp

"Connection refused" normally means that you
can talk to the other system, but that it
isn't running (or willing to run) the
requested server. This normally rules out
basic network/routing problems.

> Thoughts anyone?

Many things are possible. Some clever
firewall could do it.

> I don't have HIPS or firewall configured on
> this server.

Which server is "this server"? What's
_between_ the systems?

> sshd is running.

So you claim. (I see no evidence.) On what?

You're hiding the actual commands, so it's
hard to know what you really did, but
"sftp.domainname.com" might mean different
things on the two systems. Specifying an IP
address might change the results.
OldSchool
Honored Contributor

Re: Getting "Connection Refused" message when using sftp

any chance you're using non-std ports, ie. other than 22?
Tingli
Esteemed Contributor

Re: Getting "Connection Refused" message when using sftp

Take a look at /var/adm/log/syslog.log, there might be some info there.
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

No HIPS or firewall on mine (the client server). The sftp server is a remote vendor. We have a firewall appliance on our side, but as I can at least get to a login prompt from my Windows workstation, which is on the same domain as the client server, and I can hit it from a SCO box, so I don't believe the appliance is the problem.

It seems to me to be localized to this HP-UX box. I'm just trying to figure out if I missed something obvious.

And yes,

ps -ef | grep sshd
root 1502 1 0 Apr 18 ? 00:00 /opt/ssh/sbin/sshd

Using the ip address made no difference.
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

Using port 22. Even tried telneting to that port.

syslog didn't show anything out of the ordinary.

Steven Schweda
Honored Contributor

Re: Getting "Connection Refused" message when using sftp

> [...] I can hit it [...]

This means? (My psychic powers are weak.)

> Using the ip address made no difference.

And you tried using "the ip address" on the
Windows system, too? Showing actual commands
with their actual output (that is, actual
evidence) can be _so_ much clearer than vague
descriptions and interpretations.

> ps -ef | grep sshd
> root 1502 1 0 Apr 18 ? 00:00 /opt/ssh/sbin/sshd

If that's on your local SFTP client system,
then who cares? You're trying to talk to the
sshd on the remote server system. Aren't
you? _That's_ where sshd (or something like
it) needs to be running.

For a good time, you might try (everywhere)
a command like:

telnet 22

where is the name or IP address
of the SFTP server. This would tend to
eliminate some potential client-side SSH
configuration quirks.
OldSchool
Honored Contributor

Re: Getting "Connection Refused" message when using sftp

"Using port 22. Even tried telneting to that port."

right...that was here:

"ssh: connect to host sftp.domainname.com port 22: Connection refused"


But, what I meant is: is this different from the boxes which work?
Steven Schweda
Honored Contributor

Re: Getting "Connection Refused" message when using sftp

> Using port 22. Even tried telneting to that
> port.

You can probably see exactly what you're
doing (and where), and what happens when you
do it, but we non-psychics often can't.
Please try to keep this in mind.
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

hi,

You say that atleast u got login prompt. are u able to login
is the session diconnecting.

Please check the time stamp of /var/adm/net*

if it is latest, please give the o/p of the following
netfmt -t -f /var/adm/

Cheers,
Ravi.
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

the command is

netfmt -t 5 -f /var/adm/
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

Okay, I need the help but I really don't need the sarcasm.

I'm using the IP address now on all my tests to rule out a DNS problem.

I get a login prompt from the remote system when I use Putty on my Windows system, using an IP address.

You were questioning my claim that sshd was running. Apologies for not specifying that I checked it on my system. Doesn't the fact that I could get the login prompt from the remote server on the SCO and Windows boxes indicate that sshd was running on the remote system?

And if I haven't stripped your gears by my previous comments to the point where you won't help me...

From the SCO box:

telnet 65.79.165.194 22
Trying 65.79.165.194...
Connected to 65.79.165.194.
Escape character is '^]'.
SSH-2.0-VShell_2_6_4_448 VShell

From the Windows box:

login as:

From the HP-UX client:

telnet 65.79.165.194 22
Trying...
telnet: Unable to connect to remote host: Connection refused

G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

Hi,

Also please give me the o/p of ssh -v -v server name

and try restarting sshd

/sbin/init.d/secsh stop
/sbin/init.d/secsh start

Cheers,
Ravi.
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

OpenSSH_4.5p1+sftpfilecontrol-v1.1-hpn12v14, OpenSSL 0.9.7l 28 Sep 2006
HP-UX Secure Shell-A.04.50.021, HP-UX Secure Shell version

Stopping and restarting the service on my side (client) didn't help.
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

Hi,

Please check the time stamp of /var/adm/net*

if it is latest, please give the o/p of the following
netfmt -t -f /var/adm/

Ravi.
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

Time stamp on /var/adm/nettl.LOG000 is December 1.
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

Hi,

I think the connection is getting refused because of protocal version. Since it working with putty,

I need you to try the following from the hpux client.

ssh -1 hostname
ssh -2 hostname

Ravi.
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

# ssh -1 sftp.domainname.com
ssh: connect to host sftp.domainname.com port 22: Connection refused
# ssh -2 sftp.domainname.com
ssh: connect to host sftp.domainname.com port 22: Connection refused
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

ssh -v -v -v sftp.domainname.com
o/p please.
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

ssh -v -v -v CARSFTP.EDIFACEINFO.COM
OpenSSH_4.5p1+sftpfilecontrol-v1.1-hpn12v14, OpenSSL 0.9.7l 28 Sep 2006
HP-UX Secure Shell-A.04.50.021, HP-UX Secure Shell version
debug1: Reading configuration data /opt/ssh/etc/ssh_config
debug3: RNG is ready, skipping seeding
debug2: ssh_connect: needpriv 0
debug1: Connecting to sftp.domainname.com [###.###.###.###] port 22.
debug1: connect to address ###.###.###.### port 22: Connection refused
ssh: connect to host sftp.domainname.com port 22: Connection refused

*(IP address has been sanitized)
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

whereis ssh
swlist -l product |grep -i secure
Cheers,
Ravi
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

# whereis ssh
ssh: /usr/bin/ssh /opt/ssh/bin/ssh /opt/ssh/share/man/man1/ssh.1
# swlist -l product |grep -i secure
Secure_Shell A.04.50.021 HP-UX Secure Shell
openssl A.00.09.07m.003 Secure Network Communications Protocol
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

I hope you are trying to do sftp or ssh using a normal account and not a root account.

Is your HpUx client and server are in same subnet.

Do you have access to the target system?

Ravi.
Paul Maglinger
Regular Advisor

Re: Getting "Connection Refused" message when using sftp

I'm using a normal account, not root.

They are not in the same subnet. This is a remote server at another business.

I do not have access to their server.
G V R Shankar
Valued Contributor

Re: Getting "Connection Refused" message when using sftp

The windows box, sco box and hpux box are in the same subnet. Am i correct?