4

If I try to connect to my server via any console, etc.:

➤ ssh -vv xx.xx.xxx.xx:1337
OpenSSH_7.1p2, OpenSSL 1.0.1g 7 Apr 2014
debug1: Reading configuration data /etc/ssh_config
_ssh: Could not resolve hostname xx.xx.xxx.xx:1337: Name or service not known

Obviously something is not working.

Good thing is that I can connect to it via browser with Web Console (provided by Vultr). And if I type same thing on web console ssh [email protected] -p 1337 it logs me in.

I stopped UFW firewall and reset my iptables. Ports look OK.

Screenshot

Why I can't login to my server via consoles?

update: Apparently the local environment I was using to connect was blocking ssh, after unblocking it and running ssh -p 1337 [email protected] I get this:

ssh_exchange_identification: read: Connection reset by peer
8
  • 1
    Have you tried connecting via ssh xx.xx.xxx.xx -p 1337? In some places, : is no longer allowed to specifiy the port, so you have to use -p (e.g. in the mysql client), and in my tries, I also could not connect to my servers adding the port via :. Apr 11, 2017 at 9:42
  • 1
    @DavidGeorgReichelt may as well post that as an answer.
    – terdon
    Apr 11, 2017 at 9:51
  • Have a look into the server log, if you can notice a reason why the connection was reset.
    – Jakuje
    Apr 11, 2017 at 10:04
  • @Jakuje auth.log reports only "sshd[3354]: refused connect from my_ip (my_ip)" Apr 11, 2017 at 10:10
  • What is the complete error message you can see there. There is no such error message in OpenSSH that would say "refused connect".
    – Jakuje
    Apr 11, 2017 at 10:14

1 Answer 1

1

Manual page for ssh clearly explains the synopsis of the ssh command:

 ssh [...] [-p port] [...] [user@]hostname [...]

You can not add a port after the hostname. You should use the following:

ssh -p 1337 xx.xx.xxx.xx

Edit after gathering more details: The important part is

connection refused by tcp_wrapper

Your server is configured to refuse connections from some IP addresses in /etc/hosts.allow and/or /etc/hosts.deny. Review these rules and adjust them if you want to be able to ssh from your IP.

5
  • now I get "ssh_exchange_identification: read: Connection reset by peer" Apr 11, 2017 at 10:03
  • I updated the answer with the reasons for the reject.
    – Jakuje
    Apr 11, 2017 at 10:49
  • fixed! but how did my ip got added to the bottom of hosts.deny list? Apr 11, 2017 at 11:00
  • It could have been added by fail2ban or similar tool running on the server and banning clients trying to authenticate (and failing) too often.
    – Jakuje
    Apr 11, 2017 at 11:01
  • 1
    It was denyhosts service. Apr 11, 2017 at 12:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .