LoginSignup
65
64

More than 5 years have passed since last update.

vagrant上、共有ファイルのパーミッションを変更する

Posted at

vagrantはホスト(あなたのPC)とゲスト(仮想マシン)で共有フォルダを作ってくれていて、わざわざvagrant sshしなくても、ソースコードをいじれたりします。

ただ共有フォルダ内のファイル・フォルダのパーミッションがchmodをしても変えられなかったので、変える方法をメモ。(ちなみになんでこうゆう仕様になってるんですかね・・?)

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

上記を追加すればok。'dmode'がディレクトリ、'fmode'がファイルのパーミッションのこと。
Vagrantfileを書き換えるときは、最初に

cp Vagrantfile Vagrantfile.dist

としてバックアップをとっておいたほうが◎。

65
64
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
65
64