3

我正在运行一个 vagrant VM 并且有一个 laravel 应用程序,它使用一个名为 assets 的文件夹来创建一个目录来存储子目录和文件。创建文件夹后,权限仅设置为只读。即使使用 sudo 命令更改目录的权限,错误仍然存​​在。

vagrant 文件的配置;

Vagrant.configure("2") do |config|
  config.vm.box = "wheezy64"
  config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box"

  config.vm.network "private_network", ip: "192.168.36.49"

  config.vm.synced_folder "./", "/var/www", id: "webroot", :group => "www-data", :owner => "vagrant", :nfs => false

  config.vm.usable_port_range = (2200..2250)
  config.vm.provider :virtualbox do |virtualbox|
    virtualbox.customize ["modifyvm", :id, "--name", "premierPortal"]
    virtualbox.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    virtualbox.customize ["modifyvm", :id, "--memory", "1024"]
    virtualbox.customize ["setextradata", :id, "--VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
  end

  config.vm.provision :shell, :path => "shell/initial-setup.sh"
  config.vm.provision :shell, :path => "shell/update-puppet.sh"
  config.vm.provision :shell, :path => "shell/librarian-puppet-vagrant.sh"
  config.vm.provision :puppet do |puppet|
    puppet.facter = {
      "ssh_username" => "vagrant"
    }

    puppet.manifests_path = "puppet/manifests"
    puppet.options = ["--verbose", "--hiera_config /vagrant/hiera.yaml", "--parser future"]
end

  config.ssh.username = "vagrant"

  config.ssh.shell = "bash -l"

  config.ssh.keep_alive = true
  config.ssh.forward_agent = false
  config.ssh.forward_x11 = false
  config.vagrant.host = :detect
end

我尝试更改 vagrant 配置文件中的组和所有者,并使用新设置重新加载 vm,但似乎没有任何效果。唯一有效的方法是在每次创建文件夹时手动更改每个权限。

4

1 回答 1

0

您想像这样将“mount_options”添加到 config.vm.synced_folder 的末尾(例如,我在这里,显然您只需要结束位!):

config.vm.synced_folder "deploy", "/var/www", id: "vagrant-root", :mount_options => ["dmode=777","fmode=666"]
于 2013-12-02T00:07:55.460 回答