Vagrant Up by Non-Sudo Vagrant User fails

别说谁变了你拦得住时间么 提交于 2019-12-13 06:47:00

问题


I created a new non-sudo user(user1) in vagrant(Ubuntu 12.04 OS), and added the insecure public key to the user1 authorised key file. In vagrant file, added the default user as "user1" :

config.ssh.default.username = "user1"

Now vagrant up is failing with following error message:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p /vagrant

Stdout from the command:

Stderr from the command:

sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: 3 incorrect password attempts

But if am setting the sudo user for default user, then vagrant up is successful. Can anyone help me with the changes I need to do to enable vagrant up for non-sudo users.


回答1:


Vagrant requires root/sudo permissions on the VM for almost all of it's operations; like configuring the networking, mounting shared folders, running provisioners, etc. So you wouldn't get very useful VM without sudo even if you managed to avoid it.

Note that you only need sudo access on the guest. Vagrant commands itself can (and should) be run as a non-root user on the host.



来源:https://stackoverflow.com/questions/23760750/vagrant-up-by-non-sudo-vagrant-user-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!