gpt4 book ai didi

virtualbox - 更改/vagrant 的权限

转载 作者:行者123 更新时间:2023-12-04 20:42:43 26 4
gpt4 key购买 nike

由于/vagrant 目录的文件权限和所有权,我无法在 vagrant 中访问我的 Apache 服务器。如何更改/vagrant 的默认所有者和文件权限?

默认权限如下
drwx------ 1 vagrant vagrant 4096 Apr 18 19:53 vagrant

我可以在 Vagrantfile 中进行哪些更改来覆盖我的默认权限?

Vagrant 版本 1.5.3

我的 Vagrant 文件

Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |vb|
#...
end
config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=666"]
end

最佳答案

在 Vagrant API 版本 2 中,您可以像这样共享文件夹:

config.vm.synced_folder "/Direct/Path/To/Your/Folder", "/Direct/Path/To/The/Vagrant/Folder", :owner => "www-data", :group => "www-data"
config.vm.synced_folder "/Direct/Path/To/Another/Folder", "/Direct/Path/To/The/Other/Vagrant/Folder", :owner => "www-data", :group => "www-data"

您可以将此信息放在以下文本之后的块中:
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.

我遇到了你描述的同样问题,我通过这种方法修复了它。希望这可以帮助。我强烈推荐有关此问题的更多信息 RT(F)M.

关于virtualbox - 更改/vagrant 的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23161697/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com