在Ubuntu(VirtualBox)中通过Vagrant创建同步文件夹时出错

时间:2018-02-12 15:55:28

标签: ubuntu vagrant virtual-machine virtualbox

我收到以下错误:

The following SSH command responded with a non-zero exit status. 
Vagrant assumes that this means the command failed!
mkdir -p /home/myuser/synced

主机:Windows 10 访客:Ubuntu Server 17.10

我的Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :


Vagrant.configure("2") do |config|

  config.vm.box = "mybox"

  config.ssh.shell = "bash -l"
  config.ssh.username = "myuser"
  config.ssh.password = "mypassword"  

  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.synced_folder "data", "/home/myuser/synced", create: true, group: "mygroup", owner: "myuser"

end

当通过SSH登录到访客时,我可以调用

mkdir -p /home/myuser/synced

没有任何问题。

1 个答案:

答案 0 :(得分:0)

问题是由于我的自定义基本框中缺少无密码sudo引起的。

如何设置无密码sudo:https://serverfault.com/a/596988

请记得使用:

User: idUser, name, email, password
Conference: idConference, name, description, date, ..., conferenceCreatorDescription, conferenceCreatorEmail, conferenceCreatorName

用于编辑sudoers文件。

有关该主题的更多信息:https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos