2014-05-20 39 views
0

我在vagrant(Ubuntu 12.04 OS)中创建了一个新的非sudo用户(user1),并将不安全的公钥添加到user1授权密钥文件。在流浪的文件,添加默认的用户为“用户1”:非Sudo Vagrant用户的流浪汉失败

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 

但如果是设置默认用户的sudo的用户,那么流浪汉:

config.ssh.default.username = "user1" 

现在无业游民了与以下错误消息失败成功。 任何人都可以帮助我做出改变,我需要做的,以启用非sudo用户流浪。

+0

为什么你想避免虚拟机上的sudo? – tmatilai

+0

因为我不希望默认用户有权访问其他用户的文件和文件夹(因为sudo用户可以使用sudo命令访问所有内容)。 – user2846870

+0

其他用户?如果你想在客机上安装或配置任何东西,你需要root权限。如果没有,为什么要使用流浪汉呢?直接创建并旋转虚拟机。 – tmatilai

回答

4

Vagrant需要VM上的root/sudo权限才能执行几乎所有的操作;比如配置网络,安装共享文件夹,运行预配置等等。所以,即使设法避开它,你也不会在没有sudo的情况下获得非常有用的虚拟机。

请注意,您只需要guest上的sudo访问权限。 Vagrant命令本身可以(也应该)以主机上的非root用户身份运行。

+0

那么,如何为这个默认用户单独提供所需的访问权限(通过编辑/ etc/sudoers)呢?那么应该给予默认用户什么样的所有权限? – user2846870

+0

取决于Vagrant版本,访客操作系统,你的配置,插件等。你只需要找出(从auth日志)你是否真的需要这样做。 – tmatilai

+0

如果我在评论config.vm.network:public_network并禁用共享文件夹,vagrant up正在执行而没有任何错误。但vagrant停止给出follwoing错误 – user2846870