2015-10-06 125 views
0

通過Vagrant連接到MySQL無法工作我正在使用vagrant,並且正在使用以下配置連接到我的數據庫。由於El Capitan

enter image description here

SSH密碼IST的private_key文件中/.vagrant/machines/default/virtualbox/文件夾中。這工作沒有任何問題,但因爲我已經更新到埃爾卡皮坦,我無法連接。

我得到這些細節

Querious無法創建SSH連接,因爲遠程主機拒絕的權限。

仔細檢查SSH用戶名和密碼(或公鑰,如果使用基於密鑰的驗證)是否正確。

OpenSSH_6.9p1, LibreSSL 2.1.7 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 21: Applying options for * 
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222. 
debug1: fd 3 clearing O_NONBLOCK 
debug1: Connection established. 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.9 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u2 
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH* compat 0x04000000 
debug1: Authenticating to 127.0.0.1:2222 as 'vagrant' 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr [email protected] none 
debug1: kex: client->server aes128-ctr [email protected] none 
debug1: sending SSH2_MSG_KEX_ECDH_INIT 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ssh-rsa SHA256:kBFNbCLWp1m4X03xMWxWeCjaQUEa426OsJ5IC/PNisM 
debug1: Host '[127.0.0.1]:2222' is known and matches the RSA host key. 
debug1: Found key in /Users/tzfrs/.ssh/known_hosts:11 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Trying private key: /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: password 
debug1: read_passphrase: can't open /dev/tty: Device not configured 
debug1: permanently_drop_suid: 502 
debug1: Authentications that can continue: publickey,password 
Permission denied, please try again. 

作爲requestes這是vagrant ssh-config

Host default 
    HostName 127.0.0.1 
    User vagrant 
    Port 2222 
    UserKnownHostsFile /dev/null 
    StrictHostKeyChecking no 
    PasswordAuthentication no 
    IdentityFile /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key 
    IdentitiesOnly yes 
    LogLevel FATAL 

輸出什麼我必須做的,使之重新工作?

+0

你能'流浪ssh'並且你可以粘貼'vagrant ssh-config'的輸出嗎 –

+0

我可以連接沒有問題。 – Musterknabe

+0

'ssh-config'是http://pastebin.com/9mNARCFe – Musterknabe

回答

1

我有同樣的問題,與PSequel連接到Vagrant框中的Postgresql數據庫。相同的解決方案的兩個變化:

流浪關鍵

  • 執行vagrant ssh-config
  • 你會看到一個包含線IdentityFile像/Users/stefbastiaansen/vm/precise-pangolin/.vagrant/machines/default/virtualbox/private_key
  • 連接到ssh -p 2222 -i /Users/yourusername/vm/precise-pangolin/.vagrant/machines/default/virtualbox/private_key [email protected]在一個新的終端窗口
  • 您會收到通知,說明主機的真實性(127.0.0.1:2222)無法確認,以及您是否確定希望繼續連接。回答是。
  • 然後打開PSequel(Postgres)或Sequel Pro(MySQL)並將其配置爲SSH隧道。

    • 主持人:127.0.0.1
    • 端口:2222
    • 用戶:流浪漢
    • 標識文件:/Users/yourusername/vm/precise-pangolin/.vagrant/machines/default/virtualbox/private_key
  • 連接。

自己的密鑰

  • 你的公鑰複製到剪貼板:pbcopy < ~/id_rsa.pub
  • ssh vagrant
  • 你的公鑰添加到~/.ssh/authorized_keys在漂浮的盒子
  • 打開一個新的終端窗口
  • ssh -p 2222 [email protected]
  • 您會看到主機的真實性(127.0.0.1:2222)無法確認,以及是否確定要繼續連接的問題。回答是。
  • 然後打開PSequel(Postgres)或Sequel Pro(MySQL)並將其配置爲SSH隧道。

    • 主持人:127.0.0.1
    • 端口:2222
    • 用戶:流浪漢
    • 標識文件:的〜/ .ssh/id_rsa
  • 連接。

這是在通過ssh連接之前需要發生的確認步驟。