Vagrant卡在连接超时重试中(服务器拒绝了我们的密钥)



我的流浪汉昨晚工作得很好。我刚打开电脑,点击流浪汉,这就是我得到的:

vagrant up                                                                     
Bringing machine 'machine1' up with 'virtualbox' provider...                     
==> machine1: Checking if box 'puphpet/ubuntu1404-x64' is up to date...          
==> machine1: Clearing any previously set forwarded ports...                     
==> machine1: Clearing any previously set network interfaces...                  
==> machine1: Preparing network interfaces based on configuration...             
    machine1: Adapter 1: nat                                                     
    machine1: Adapter 2: hostonly                                                
==> machine1: Forwarding ports...                                                
    machine1: 22 (guest) => 9180 (host) (adapter 1)                              
    machine1: 22 (guest) => 2222 (host) (adapter 1)                              
==> machine1: Running 'pre-boot' VM customizations...                            
==> machine1: Booting VM...                                                      
==> machine1: Waiting for machine to boot. This may take a few minutes...        
machine1: SSH address: 127.0.0.1:2222                                        
machine1: SSH username: vagrant                                              
machine1: SSH auth method: private key                                       
machine1: Warning: Remote connection disconnect. Retrying...                 
machine1: Warning: Remote connection disconnect. Retrying...                 
machine1: Warning: Authentication failure. Retrying...                       
machine1: Warning: Authentication failure. Retrying...                       
machine1: Warning: Authentication failure. Retrying...                       
machine1: Warning: Authentication failure. Retrying...                       
machine1: Warning: Authentication failure. Retrying...                       
machine1: Warning: Authentication failure. Retrying...                       
machine1: Warning: Authentication failure. Retrying...                       
machine1: Warning: Authentication failure. Retrying...                       

当我尝试连接时,我看到了这个:

Using username "vagrant".
Server refused our key
vagrant@127.0.0.1's password:

但我的密钥文件没有改变。有类似的问题Vagrant卡住连接超时重试,但还有其他原因,这对我没有帮助。

有ssh配置

> vagrant ssh-config                                              
Host machine1                                                     
HostName 127.0.0.1                                              
User vagrant                                                       
Port 2222                                                       
UserKnownHostsFile /dev/null                                    
StrictHostKeyChecking no                                        
PasswordAuthentication no                                       
IdentityFile "C:/puphpet/puphpet/files/dot/ssh/id_rsa"          
IdentityFile "C:/Users/alexk/.vagrant.d/insecure_private_key"   
IdentitiesOnly yes                                              
LogLevel FATAL                                                  

将以下代码行添加到C:HashiCorpvagrantembeddedgemsgemsvagrant-1.8.5pluginsguestslinuxcappublic_key.rb:

chmod 0600 ~/.ssh/authorized_keys


原始块: if test -f ~/.ssh/authorized_keys; then grep -v -x -f '#{remote_path}' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.tmp mv ~/.ssh/authorized_keys.tmp ~/.ssh/authorized_keys fi

新建块: if test -f ~/.ssh/authorized_keys; then grep -v -x -f '#{remote_path}' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.tmp mv ~/.ssh/authorized_keys.tmp ~/.ssh/authorized_keys chmod 0600 ~/.ssh/authorized_keys fi

我也遇到了同样的问题,并在这里找到了上述解决方案。

相关内容

  • 没有找到相关文章