Can't ssh into server, connection refused
Solution 1
In the past I've had this problem and solved it by using a LAN IP to connect to the server, instead of the domain name or hostname.
Solution 2
I'm not sure about MobaXterm, but I know PuTTY stores known server SSH fingerprints in the registry, and some versions made it quite difficult to connect to a server if its fingerprint had changed (and weren't very verbose in their diagnostic output).
Could it be that the fingerprint for your server has changed and your terminal program is protecting you from bad things?
Related videos on Youtube
ksnortum
Updated on September 18, 2022Comments
-
ksnortum over 1 year
I can't
ssh
into my server. The server is on a private network administrated by me. Ubuntu is version 14.04. This started when I changed to a wired ethernet card. The client is MobaXTerm (latest) on Windows 7. This is what I have done:- The client can
ping
the server - The server can
ping
the client - I can
ssh localhost
on the server with no problems ufw status
shows port 22 opennetstat -l
shows port 22 listening
I did a
iptable --list
but honestly I'm not sure of what I'm seeing. Here are the lines that havessh
in them:ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT udp -- anywhere anywhere udp dpt:ssh
I'd post the whole output except that I have no good way to get it off the server.
All suggestions are welcome.
-
Sean almost 10 yearsPerhaps the server settings is the issue. I'd review /etc/ssh/sshd_config on the server. You want, at least to start, to allow password authentication with "PasswordAuthentication yes" (that's the default setting).
-
ksnortum almost 10 yearssshd_config has PasswordAuthentication set to yes.
-
Sean almost 10 yearsIf possible I'd try your ssh client on a Linux machine to eliminate any question of the issue being with the Windows program. I use Cygwin ssh on Windows to connect to Ubuntu ssh servers but have no experience with MobaXTerm.
-
Panther almost 10 yearsCygwin is a bit of overkill =) , I suggest you use PuTTy, it is freely available and portable - chiark.greenend.org.uk/~sgtatham/putty/download.html
-
ksnortum almost 10 yearsI've tried PuTTy, same message.
- The client can
-
user285808 almost 10 yearsYes, but had you used putty to connect to the server before you changed to a wired connection? If so it could be refusing to let you access because it doesn't match the one stored in the registry.
-
a different ben about 8 yearsKeys seem to be shared amongst Cygwin, PuTTy, and WinSCP... all of these were refusing my attempts to connect to a server that had changed. Using the IP worked, but I haven't tried to find how to remove the hostname/domain-based key yet.