よろしくお願いします。
(環境)Virtualbox 5.2
ホスト:Windows10
ゲスト:CentOS 6.9
Virtualboxの機能を使ってゲストOSとホストOSの共有ディレクトリを作成しています。
ここで、ゲストOS内に作られる共有フォルダ(sf_SHARED)を、Webサーバのhtdocsとしてシンボリックリンクを作りたいと考えています。
どのように設定すれば実現できるのか、ご教授いただけないでしょうか。
よろしくお願いします。
私がやったことはシンボリックリンクを作り、chown、chmodで変更しました。しかしユーザー・グループ(root:vboxsf)が変更できません。
VirtualBox本体側の設定で自動マウントのチェックを外せば変更できるようになりますが、今度は共有フォルダが機能しなくなります。
言わずもがなかもしれませんが、Windows側でコーディングを行ったものをそのままゲストOS側に適用させたいのです。
いろいろネット検索してみましたが近いような説明はあったもののズバリのものがなく、こちらに質問させていただきました。
(追記)
ご回答ありがとうございます。
手隙がなくまだ確認できていませんが、確認次第、返事させていただきます。
気になる質問をクリップする
クリップした質問は、後からいつでもMYページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
回答3件
0
ベストアンサー
kpluplusさん、
ユーザー・グループ・パーミッションの設定ですが、vboxsfのmountのオプションで設定できます。
また、/etc/rc.local
に記述することで、起動時にマウントさせることができます。
- VirtualBoxの仮想機の共有設定で、自動マウントにチェックを入れない。
- 仮想機、起動後、手動で
sudo mount -t vboxsf {共有フォルダ名} /マウント先フォルダ -o オプション
といった感じでマウントします。
実行例
# ユーザ・グループ番号を調べる $ id uid=500(vagrant) gid=500(vagrant) groups=500(vagrant) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 # マウントを実行 $ sudo mount -t vboxsf windows_no_htdocs /opt/lampp/htdocs -o rw,uid=500,gid=500,fmode=0700,dmode=770 # 確認 $ ls -l /opt/lampp/htdocs total 41 -rwx------. 1 vagrant vagrant 3607 Feb 27 2017 applications.html -rwx------. 1 vagrant vagrant 177 Feb 27 2017 bitnami.css drwxrwx---. 1 vagrant vagrant 4096 Nov 16 01:15 dashboard -rwx------. 1 vagrant vagrant 30894 May 11 2007 favicon.ico drwxrwx---. 1 vagrant vagrant 0 Nov 16 01:15 img -rwx------. 1 vagrant vagrant 260 Jul 9 2015 index.php drwxrwx---. 1 vagrant vagrant 0 Nov 16 01:15 webalizer
/etc/rc.local
の例
$ cat /etc/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local # vboxsf mount mount -t vboxsf windows_no_htdocs /opt/lampp/htdocs -o rw,uid=500,gid=500,fmode=0700,dmode=770
- 参考: vboxsfのマウントオプション
$ sudo mount.vboxsf -h Usage: mount.vboxsf [OPTIONS] NAME MOUNTPOINT Mount the VirtualBox shared folder NAME from the host system to MOUNTPOINT. -w mount the shared folder writable (the default) -r mount the shared folder read-only -n do not create an mtab entry -s sloppy parsing, ignore unrecognized mount options -o OPTION[,OPTION...] use the mount options specified Available mount options are: rw mount writable (the default) ro mount read only uid=UID set the default file owner user id to UID gid=GID set the default file owner group id to GID ttl=TTL set the "time to live" to TID for the dentry dmode=MODE override the mode of all directories to (octal) MODE fmode=MODE override the mode of all regular files to (octal) MODE umask=UMASK set the umask to (octal) UMASK dmask=UMASK set the umask applied to directories only fmask=UMASK set the umask applied to regular files only iocharset CHARSET use the character set CHARSET for I/O operations (default set is utf8) convertcp CHARSET convert the folder name from CHARSET to utf8 Less common used options: noexec,exec,nodev,dev,nosuid,suid
投稿2017/11/16 02:10
編集2017/11/16 02:11総合スコア1825
0
apacheユーザーをvboxsfグループに追加してやれば望みの動作になるかと思います。
その際、更新がすぐに反映されない場合は
http://d.hatena.ne.jp/keywordtouch/Vagrant
のような設定を行えば解決することが多いです
投稿2017/11/15 13:18
総合スコア18713
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
0
違ったアプローチになりますが
Windows側でコーディングを行ったものをそのままゲストOS側に適用させたい
ということを実現するということが目的であれば
Virtualboxの機能を使ってゲストOSとホストOSの共有ディレクトリを作成
よりも Linux の機能で共有させる方が手っ取り早いのでは?
Linux のフォルダを Windows からアクセスできるようにする
上記のサイトなどを参考にされてはいかがでしょうか。
投稿2017/11/15 00:11
総合スコア1638
あなたの回答
tips
太字
斜体
打ち消し線
見出し
引用テキストの挿入
コードの挿入
リンクの挿入
リストの挿入
番号リストの挿入
表の挿入
水平線の挿入
プレビュー
質問の解決につながる回答をしましょう。 サンプルコードなど、より具体的な説明があると質問者の理解の助けになります。 また、読む側のことを考えた、分かりやすい文章を心がけましょう。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/16 15:46