gpt4 book ai didi

vagrant + Permission denied 造币厂

转载 作者:行者123 更新时间:2023-12-01 07:27:54 25 4
gpt4 key购买 nike

我只用了 2 天。我看到很多类似的帖子,但我无法解决我的问题。

我将 Mint 18 作为主要操作系统 (4.4.0-21-generic#37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux),现在我有:

  • virtualbox 5.0.40 r115130

  • Vagrant 1.8.4 + vagrant-vbguest (0.14.2)

虚拟机安装正确。当我尝试运行“vagrant ssh”时,我看到:

Permission denied (publickey)

我的配置:

Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
config.vm.network "private_network", ip: "192.168.56.106"
config.vm.synced_folder '.', '/home/vagrant'
end

Synced_folder 工作正常。

Vagrant ssh 配置

 Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/wiktor/NetBeansProjects/PhpProject1/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL

并且:ssh -i/home/wiktor/NetBeansProjects/PhpProject1/.vagrant/machines/default/virtualbox/private_key -v vagrant@localhost -p 2222

OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 2222.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/NetBeansProjects/PhpProject1/.vagrant/machines/default/virtualbox/private_key type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/NetBeansProjects/PhpProject1/.vagrant/machines/default/virtualbox/private_key-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/identity type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/identity-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/wiktor/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:2222 as 'vagrant'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:bfFoWuZbyskLe9SNF07Qkt6biJYCFhn83Yxy4RAIiGw
debug1: Host '[localhost]:2222' is known and matches the ECDSA host key.
debug1: Found key in /home/wiktor/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/wiktor/NetBeansProjects/PhpProject1/.vagrant/machines/default/virtualbox/private_key
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/wiktor/.ssh/identity
debug1: Trying private key: /home/wiktor/.ssh/id_rsa
debug1: Trying private key: /home/wiktor/.ssh/id_dsa
debug1: Trying private key: /home/wiktor/.ssh/id_ecdsa
debug1: Trying private key: /home/wiktor/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

我不明白这个错误。可能 vagrant 无法生成公钥。

通过 VirtualBox 连接到 VM 并运行“ls -la/home/vagrant”后,我没有看到目录“.ssh”。对吗?

我尝试运行 virtualbox 5.1 和 vagrant 1.8.5,但我有同样的错误。

当我在不正确的公钥/私钥后使用 Windows10 时,这会向 vagrant 用户请求密码。On Mint 返回错误。我在客户机和主操作系统上更改了 chmod 并编辑了/etc/ssh/sshd_config。这没有帮助。

有人能帮忙吗?

最佳答案

问题是由于您的 vagrantfile 中的以下行

  config.vm.synced_folder '.', '/home/vagrant' 

vagrant 用户的 authorized_keys 文件位于 vagrant 机器内的 /home/vagrant/.ssh 中,可以通过 ssh 进入 vagrant box。

当您将当前目录挂载到 /home/vagrant 时,/home/vagrant 的所有内容都被覆盖并且没有 authorized_keys 文件。

将安装路径更改为除 /home/vagrant 之外的任何内容,您将能够通过 ssh 进入机器。例如

  config.vm.synced_folder '.', '/home/vagrant/somepath'  

关于vagrant + Permission denied 造币厂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44029655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com