Vagrant编辑文件夹的所有者会引发语法错误

时间:2014-08-11 19:29:49

标签: laravel permissions vagrant virtualbox

您好我正在尝试编辑我所拥有的laravel目录的所有者,我通过配置文件为vagrant执行此操作,如下所示:

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

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
  config.vm.network :private_network, ip: "192.168.33.21"
  config.vm.provision :shell, :path => "install.sh"
  config.vm.synced_folder ".", "/var/www”
    config.vm.share_folder "v-root", "/tempus2/app/storage", ".", :owner => "www-data"

end

然而我收到以下错误:

 Users/guti/Public/Sites/Vagrantfile:13: syntax error, unexpected tIDENTIFIER, expecting
 keyword_end
 config.vm.share_folder "v-root", "/tempus2/app/storage...
                       ^
/Users/guti/Public/Sites/Vagrantfile:13: syntax error, unexpected tSTRING_BEG, expecting     keyword_do or '{' or '('
...config.vm.share_folder "v-root", "/tempus2/app/storage", "."...
...                               ^
/Users/guti/Public/Sites/Vagrantfile:13: syntax error, unexpected tSTRING_BEG, expecting     keyword_do or '{' or '('
...v-root", "/tempus2/app/storage", ".", :owner => "www-data"
...                               ^
/Users/guti/Public/Sites/Vagrantfile:13: syntax error, unexpected tSTRING_BEG, expecting '('
...t", "/tempus2/app/storage", ".", :owner => "www-data"
...                               ^
/Users/guti/Public/Sites/Vagrantfile:13: syntax error, unexpected tIDENTIFIER, expecting keyword_end
...p/storage", ".", :owner => "www-data"
...                               ^
/Users/guti/Public/Sites/Vagrantfile:13: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
/Users/guti/Public/Sites/Vagrantfile:13: unterminated string meets end of file

www-data的正确语法是什么?另外我如何扩展配置文件以将此文件夹和所有子目录的权限更改为777?

我想做的就是让tempus2 / app / storage目录可以通过www-data写入laravel用途。我的机器人上的完整目录是User / [username] / Public / Sites / tempus2 /,我的vm是/ var / www / tempus2,或者当我进入vagrant cd / vagrant / tempus2时。但是如何为我的流浪者vm更改此文件夹的权限?

1 个答案:

答案 0 :(得分:3)

share_folder在Vagrant 1.1+中不可用(这是旧语法),现在是synced_folder。看起来你的“/ var / www”行上的双引号实际上并不是双引号字符,可能是从某处复制和粘贴的。