流浪的权限问题

时间:2015-10-29 13:15:21

标签: permissions vagrant chmod

这是我的流浪文件。问题出在`var / www里面我无法使用下面的配置设置特定文件夹的权限。例如,var / www / sample文件夹必须设置为777权限。但我不能这样做,既不使用root帐户也不使用vagrant帐户。试图将moun的类型改为rsync。仍然是同样的问题。

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

# check and install required Vagrant plugins
required_plugins = ["vagrant-hostmanager"]
required_plugins.each do |plugin|
    if Vagrant.has_plugin?(plugin) then
        system "echo OK: #{plugin} already installed"
    else
        system "echo Not installed required plugin: #{plugin} ..."
        system "vagrant plugin install #{plugin}"
    end
end

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"

  config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"

  config.vm.provision :shell,
    keep_color: true,
    path: "provision/setup.sh"

  config.vm.box_check_update = true

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

  config.vm.synced_folder '.', '/vagrant', disabled: true
  config.vm.synced_folder "./", "/var/www", create: true, group: "vagrant", owner: "vagrant", type: "rsync"

   config.vm.provider "virtualbox" do |vb|
     vb.name = "Web Server"
     vb.gui = false
     vb.memory = "512"
   end


end

我做错了什么?

1 个答案:

答案 0 :(得分:0)

更改为

config.vm.synced_folder "./", "/var/www", group: "vagrant", owner: "vagrant", mount_options: ["dmode=777, fmode=664"]

这使得目录具有777模式,文件具有664 - 您可以根据需要调整这些值