I feel like a complete dunce – but I cannot seem to connect with Terminal.app and SSH to a non-standard SSH port. I’m on Mountain Lion.
I’ve tried all of the following:
$ ssh myuser@mysite.com -p 42586
$ ssh myuser@mysite.com -p42586
$ ssh -p 42586 myuser@mysite.com
$ ssh -p42586 myuser@mysite.com
I cannot seem to get the syntax right, all of the above produce an error. What is the correct order of flags? I have checked the man page and it shows it as preceding the [user]@[domain] section, however, this throws an error as well.
Edit:
More information and raw terminal output:
$ 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]
Examples 1 and 2 hang until timeout. 3 and 4 produce a grep usage echo as well as an ssh usage echo.
Edit 2:
Thanks for the suggestion @topguncoder my original attempt was the colon notation – but that produces a different error:
$ ssh myuser@mysite.com:42586
ssh: Could not resolve hostname mysite:42586: nodename nor servname provided, or not known
Try
to ignore your
aliassettings. It looks like you might havesshaliased to something else. If this works, you should check your.profilefor anysshaliases.