Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?

More than 1 year has passed since last update.

@tatsuo-iriyama

vagrantの共有フォルダ内のファイルにchmodが効かない場合

Vagrantfileに以下を記載

config.vm.synced_folder "./", "/vagrant", mount_options: ['dmode=777','fmode=777']

記載後↓

Vagrant.configure("2") do |config|
    config.vm.synced_folder "./", "/vagrant", mount_options: ['dmode=777','fmode=777']
end

記載後、vagrantを再起動して、chmod出来なかったファイルに再度アタックすれば出来ます。

記載内容の解説

 config.vm.synced_folder
→ホストとゲスト間でディレクトリを共有できるようにする事ができるメソッド

第一引数は、ホストディレクトリの指定
第二引数は、ゲストディレクトリの指定
第三引数は、オプションの指定(任意)

Synced folders are configured within your Vagrantfile using the config.vm.synced_folder method.
The first parameter is a path to a directory on the host machine.If the path is relative, it is relative to the project root.
The second parameter must be an absolute path of where to share the folder within the guest machine.
You may also specify additional optional parameters when configuring synced folders.

mount_options
→マウント時のオプションを配列で設定。

mount_options (array) - A list of additional mount options to pass to the mount command.

dmode
→ディレクトリのパーミッション設定

fmode
→ファイルのパーミッション設定

引用は全てVagrantのDocsからです。
https://www.vagrantup.com/docs/synced-folders/basic_usage.html

0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
0
Help us understand the problem. What is going on with this article?