ssh命令行指定用户端口连接
在公网服务器上面进行ssh连接时使用默认22端口很容易被扫出,恶意登录。这时候可以通过修改默认端口号,指定端口号进行连接。
ssh指定用户端口连接
ssh wei@10.0.0.127 -p 2204
#ssh参数如下
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-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]]
[user@]hostname [command]
xshell用ssh指定用户和端口连接报“Invalid port number.”
xshell指定用户和端口报错,会发现包端口号阻止,其实是xshell对ssh命令进行封装将-p选项进行优化,
$ ssh wei@10.0.0.127 -p 2204
Invalid port number.
xshell正确连接
ssh wei@10.0.0.127 2204
分析:
1、查看IP和port是否通信正常 2、检查防火墙及其他安全策略 3、若上面都是正常,则需要从xshell进行对比验证 4、查看xshell帮助文档 5、根据报错Google问题