ssh修改默认端口号后无法连接(提示ssh: Could not resolve hostname)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh修改默认端口号后无法连接(提示ssh: Could not resolve hostname)相关的知识,希望对你有一定的参考价值。

ssh命令语法:
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user@]host[:port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] destination [command]
本地修改端口后无法连接ssh
C:Usersjition>ssh jition@127.0.0.1:2222
ssh: Could not resolve hostname 127.0.0.1:2222: 262273326252265300325342321371265304326367273372241243

解决方法:

    使用指定端口号登录(-l 表示login_name -p 表示端口号)

[cqs@centos7 ~]$ ssh -l jition 192.168.1.105 -p 2222

The authenticity of host ‘[192.168.1.110]:2222 ([192.168.1.110]:2222)‘ can‘t be established.
ECDSA key fingerprint is SHA256:Tui3jBxEkVlIvIlMGbv2SoijP9xP4bPflwoUPV+gX4o.
Are you sure you want to continue connecting (yes/no)? no

以上是关于ssh修改默认端口号后无法连接(提示ssh: Could not resolve hostname)的主要内容,如果未能解决你的问题,请参考以下文章

修改ssh服务器默认端口

centos6.X修改ssh默认端口号

linux下已经更改了ssh默认登陆端口22,如何扫描出来更改后的端口号呢。使用NMAP扫描不到,有其他方法么?

在linux下登录ssh怎么指定端口

CentOS修改ssh端口号及ssh免密码登录

修改Linux主机ssh远程默认端口号