Vagrant OS X主机nfs共享权限错误 – 无法将所有者设置为“1000”

前端之家收集整理的这篇文章主要介绍了Vagrant OS X主机nfs共享权限错误 – 无法将所有者设置为“1000”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是一个Vagrant和Puppet新手,我使用 instructions here to install Puppet with the Puppetlabs packages创建了一个带Debian Squeeze和独立Puppet的Base Box.

盒子本身似乎成功导入但是一旦我进入配置它,我得到的错误似乎与主机上的nfs共享有关. 1000是vm上Vagrant用户的uid.

错误

Error: Failed to set owner to '1000': Operation not permitted - /vagrant/www/index.PHP
Error: /Stage[main]/Perchdemo::Sites::Create/File[/vagrant/www/index.PHP]/owner: change from 501 to vagrant Failed: Failed to set owner to '1000': Operation not permitted - /vagrant/www/index.PHP

当我使用Puppet将index.PHP文件复制到主机文件系统上的share / vagrant / www时会发生这种情况.我在vm的独立安装上使用了这个Puppet模块,其中文件托管在vm的文件系统上,理想情况下我希望它们在nfs共享上.

编辑了更多信息.当我使用puppetlabs apache模块创建vhost时,最初发生了错误.无论我尝试使用哪个用户强制创建它,它都会失败并出现相同的错误.

我的VagrantFile对此如下.

Vagrant::Config.run do |config|

  config.vm.Box = "squeeze64"


  config.vm.network :hostonly,"10.1.0.52"

  config.nfs.map_uid = :auto
  config.nfs.map_gid = :auto

  config.vm.forward_port 80,8080

  config.vm.share_folder("v-web","/vagrant/www","./www",:nfs => true)


  config.vm.provision :shell,:inline => "echo \"Europe/London\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"


  config.vm.provision :shell,:inline => "apt-get update --fix-missing"
  config.vm.provision :shell,:inline => "apt-get upgrade"


  config.vm.provision :puppet do |puppet|
     puppet.facter = { "fqdn" => "perchtutorial.eoms"}
     puppet.manifests_path = "puppet/manifests"
     puppet.manifest_file  = "perchtutorial.pp"
     puppet.module_path = "puppet/modules"
  end

end

解决方法

要摆脱这个权限问题,这是我添加到我的Vagrantfile中的内容
if (/darwin/ =~ RUBY_PLATFORM) != nil
    config.vm.synced_folder ".","/host/path/to/shared/folder",nfs: true,:bsd__nfs_options => ["-maproot=0:0"]
  else
    config.vm.synced_folder ".",:linux__nfs_options => ["no_root_squash"]
  end

它将根据您的主机操作系统(OSX或Linux)调整NFS选项.

原文链接:https://www.f2er.com/linux/397825.html

猜你在找的Linux相关文章