从备份恢复后,Homestead的身份验证错误

时间:2018-03-17 16:09:11

标签: vagrant virtualbox homestead ssh-keys

在忘记备份我的数据库之前,我意外地运行了vagrant destroy。我用备份替换了我的VM目录,然后更正了UUID以便它们匹配。但是,在尝试启动Homestead时,我收到了身份验证错误:

$ homestead up
/opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/opt/vagrant/embedded/gems/gems/bundler-1.10.6/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default: 
==> default: The requested URL returned error: 404 Not Found
==> default: 
==> default: If you want to check for box updates, verify your network connection
==> default: is valid and try again.
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...

我可以在VirtualBox GUI中启动Homestead并使用vagrant / vagrant登录,但是当尝试访问浏览器中的站点时,显示No Input File Specified时,这无助于使我的站点联机。 之前在这台机器上设置了ssh密钥(备份只有几天),所以我认为身份验证仍然有效。 我如何让Homestead回归?使用OSX Sierra,VirtualBox 5.0.14,Homestead 2.2.1,Vagrant 1.8.1

当涉及到ssh键时,我有点迷失,但我已经提到了以下内容: 在OSX终端:

$ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "/Users/Myself/.vagrant.d/insecure_private_key"
IdentitiesOnly yes
LogLevel FATAL

$ cat /Users/Myself/.vagrant.d/insecure_private_key
-----BEGIN RSA PRIVATE KEY------
MIIEogIBAAKCAQEA6NF8iallvQVp22WDk..... omitted ...
-----END RSA PRIVATE KEY-----

然后我可以进入Homestead实例并运行:

$ cat ~/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADA .... omitted ...6KI3AcGkjQOt/ vagrant

回到OSX的终端,我有:

$ cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,FD8746C7776F06E98C74CBABEE95360C

MffswxNSLA1bn9/APO9/mb5QdF1...omitted
-----END RSA PRIVATE KEY-----

这些键中的一些是否需要相同?

编辑:在Homestead机器上成功运行mysqldump!但是 - 我无法弄清楚如何将它移动到我的本地机器上。共享文件夹似乎不起作用。我可以看到home / vagrant / Code目录,但它是空的,似乎不喜欢我的本地版本。在设置>我看到共享文件夹 文件夹路径:/ Users / Myself / Code 文件夹名称:home_vagrant_Code 但这似乎并没有从/ Users / Myself / Code中提取任何文件。 如果我可以从虚拟机中获取mysqldump,我会将VM回滚到工作时并从那里恢复数据库。

1 个答案:

答案 0 :(得分:0)

由于ssh身份验证错误,我无法恢复备份VM。 但是,我能够进入机器并执行mysqldump。 为了访问该文件,我遇到了安装虚拟CD的问题,它从未奏效。谢天谢地,我跑了: ls /media 然后我就可以添加一个共享目录。 找到这个目录也不是很明显,因为它位于媒体总监的一个" sf"前缀(共享文件夹)。因此,一旦我通过VirtualBox GUI设置文件夹,我就必须运行: homestead up 谢天谢地,目录就在那里。 然后我将sql转储文件复制到此目录,并能够在我的本地计算机上看到它。

下一步是使用TimeMachine恢复到旧的VM文件夹(仍然不清楚为什么备份不起作用),然后运行{{1}},一切顺利,因为我能够访问phpmyadmin并导入mysqldump文件。