Vagrant:在配置阶段创建所有者时,如何将所有者设置为同步/共享文件夹 [英] Vagrant: how to set owner to synced/shared folders when this owner is created in the provisioning phase

查看:76
本文介绍了Vagrant:在配置阶段创建所有者时,如何将所有者设置为同步/共享文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Vagrantfile(相关部分)

Vagrantfile (relevant parts)

  config.vm.provision :chef_solo do |chef|
    chef.add_recipe "yum"
    # various recipes..
    # in one of these i create the 'localuser' user
  end

  config.vm.synced_folder "./site/frontend", "/var/www/vhosts/site/frontend", :owner=> 'localuser', :group=>'apache', :extra => 'dmode=755,fmode=755'

当我做第一个 vagrant时上挂载时出现错误,因为它找不到本地用户(共享文件夹的挂载在预配之前)

When i do the first vagrant up i get an erroring on mounting because it can't find localuser (mounting of shared folders comes before the provisioning)

我该怎么办拥有与稍后创建的所有者的共享文件夹?

What can i do to have a shared folder with an owner that is created later?

推荐答案

我不知道您可以将所有者设置为像这样的文件夹...是否在文档中?

I wasn't aware you could set the owner on a folder like that... is it in the docs?

我要做的就是挂载文件夹,然后在设置步骤中以这种方式设置所有者和权限。如果该文件夹在配置之前不存在,那么我将挂载一个确实存在的文件夹,但是在设置步骤中从已安装的文件夹创建一个指向该链接的符号链接。

What I would do is mount the folder and then in the provisioning step set the owner and permissions that way... if the folder doesn't exist until provisioning that I would mount a folder that does exist but create a symlink to it from the mounted folder in the provisioning step.

I通常,也可以通过这种方式在服务器上创建AFP或Samba服务器共享和访问文件夹...它的设置更多,但比通过Vagrant挂载共享文件夹要强大得多。

I also normally create an AFP or Samba server share and access folders on the server that way... its a bit more setup but a lot more powerful than just mounting a shared folder through Vagrant.

这篇关于Vagrant:在配置阶段创建所有者时,如何将所有者设置为同步/共享文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆