Mac

與本地主機 ssh_exchange_identification 的 SSH 連接:連接被遠端主機關閉

  • April 13, 2012

在本地機器上為項目設置 SSH 訪問。

當我ssh -v localhost的連接被拒絕時。使用以下堆棧跟踪。

OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /Users/Kyle.Welsby/.ssh/config
debug1: Applying options for localhost
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /Users/Kyle.Welsby/.ssh/identity type -1
debug1: identity file /Users/Kyle.Welsby/.ssh/id_rsa type 1
debug1: identity file /Users/Kyle.Welsby/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host

我的 ssh 配置是標準的 Mac OS X 設置。進行以下改動。

# /etc/sshd_config
PermitUserEnvironment yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

# ~/.ssh/config
Host localhost
User Kyle.Welsby

問題恰好是PermitUserEnvironment yes我對此發表了評論,並且一切正常。

引用自:https://serverfault.com/questions/231586