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 root@xx.xx.xxx.xx -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 root@xx.xx.xxx.xx I get this:

ssh_exchange_identification: read: Connection reset by peer
share|improve this question
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 :. – David Georg Reichelt Apr 11 '17 at 9:42
1  
@DavidGeorgReichelt may as well post that as an answer. – terdon Apr 11 '17 at 9:51
    
Have a look into the server log, if you can notice a reason why the connection was reset. – Jakuje Apr 11 '17 at 10:04
    
@Jakuje auth.log reports only "sshd[3354]: refused connect from my_ip (my_ip)" – user3108268 Apr 11 '17 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 '17 at 10:14
up vote 2 down vote accepted

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.

share|improve this answer
    
now I get "ssh_exchange_identification: read: Connection reset by peer" – user3108268 Apr 11 '17 at 10:03
    
I updated the answer with the reasons for the reject. – Jakuje Apr 11 '17 at 10:49
    
fixed! but how did my ip got added to the bottom of hosts.deny list? – user3108268 Apr 11 '17 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 '17 at 11:01
1  
It was denyhosts service. – user3108268 Apr 11 '17 at 12:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.