我觉得自己像个傻瓜——但我似乎无法将 Terminal.app 和 SSH 连接到非标准 SSH 端口。我在山狮。
我已经尝试了以下所有方法:
$ ssh myuser@mysite.com -p 42586
$ ssh myuser@mysite.com -p42586
$ ssh -p 42586 myuser@mysite.com
$ ssh -p42586 myuser@mysite.com
我似乎无法正确使用语法,以上所有内容都会产生错误。标志的正确顺序是什么?我检查了该man
页面,它显示为在 [user]@[domain] 部分之前,但是,这也会引发错误。
编辑:
更多信息和原始终端输出:
$ ssh mysite.com -p42586
--hangs--
$ ssh mysite.com -p 42586
--hangs--
$ ssh -p42586 mysite.com
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]
$ ssh -p 42586 mysite.com
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
/usr/bin/ssh: option requires an argument -- p
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]
示例 1 和 2 挂起直到超时。3 和 4 产生一个 grep 使用回显以及一个 ssh 使用回显。
编辑2:
感谢@topguncoder 的建议,我最初的尝试是冒号 - 但这会产生不同的错误:
$ ssh myuser@mysite.com:42586
ssh: Could not resolve hostname mysite:42586: nodename nor servname provided, or not known