2013-02-05 114 views
2

我觉得自己像一个完整的傻瓜 - 但我似乎无法连接Terminal.app和SSH到非标准的SSH端口。我在山狮上。OSX Terminal.app SSH端口

我已经尝试了所有的以下内容:

$ ssh [email protected] -p 42586 
$ ssh [email protected] -p42586 
$ ssh -p 42586 [email protected] 
$ ssh -p42586 [email protected] 

我似乎无法得到正确的语法,以上所有的产生错误。什么是正确的标志顺序?我检查了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]] 
      [[email protected]]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]] 
      [[email protected]]hostname [command] 

实施例1和2挂起,直到超时。 3和4产生一个grep使用回声以及一个ssh使用回声。

编辑2:

感谢您的建议@topguncoder我最初的尝试是冒号符号 - 但产生不同的错误:

$ ssh [email protected]:42586 
ssh: Could not resolve hostname mysite:42586: nodename nor servname provided, or not known 
+1

不知道这个,但你有没有尝试过: ssh [email protected]:42586 – TopGunCoder

+2

什么是终端错误? –

+0

更新了问题以提供更多信息 – philwinkle

回答

7

尝试

"ssh" -p 42586 mysite.com 

到忽略您的alias设置。看起来你可能有ssh别名。如果这样做,你应该检查你的.profile任何ssh别名。

+3

OP:用于确认,'type ssh'的输出是什么? – chepner

+0

输出ssh:'ssh别名〜/ bin/safe_ssh'' – philwinkle

+0

作品像魅力一样,谢谢互联网。 – philwinkle

2

我相信在你的系统上,ssh命令以某种方式重新定义为grep命令。试试这个:

alias | /usr/bin/grep ssh 

你看到了什么?另外,试试这个:

/usr/bin/ssh -p 42586 [email protected] 

你有成功的连接吗?如果ssh被别名别名。检查下列文件:

  • 〜/ .bash_profile中
  • 的〜/ .bashrc
  • 〜/ .profile文件

然后,您可以删除该别名,或使用绝对路径(例如/usr/bin/ssh

+2

'type ssh'更简单。 – nneonneo

+0

谢谢。我学到了一些新东西。 –