Page 1 of 1

automount and shared folders

Posted: 14. Dec 2012, 17:42
by mikeybikey
Hi

I'm running 64 bit Fedora 16 on a 64 bit Windows 7 machine. I am trying to get shared folders to work. In the "HOWTO: Use Shared Folders" (viewtopic.php?f=29&t=15868) is says that if you do nothing special mounted shared folders will all be owned by root which is what I get. It suggests using the following command where share is set as the name of the Windows folder I want to share in Settings > Shared Folders:

Code: Select all

sudo mount -t vboxsf -o uid=1000,gid=1000 share ~/host
which indeed works.

The HOWTO then says:
If you want to have it mount automatically upon each boot, put the mount command in /etc/rc.local (Debian based distro's), or whatever script is run at the end of the boot process. The Shared Folders service should mount them automatically, but that doesn't always happen.
In my case /etc/rc.local is /etc/init.d.

It then says that if you add the command in my case to /etc/init.d so that it automounts at boot time as above you have to use the fully qualified path to the shared folder on the guest:

Code: Select all

mount -t vboxsf share /home/<username>/host
So I did that along with the options "-o uid=1000,gid=1000" from above and what happens is that the Windows folder doesn't get mounted at /home/mike/host but rather at /media/sf_share and everything is still owned by root.

Could somebody please tell me what I'm doing wrong. I've looked at the foums, Googled and read the HOWTO and I can't find a consistent answer.

Thanks very much in advance.

Best,
Mike

Re: automount and shared folders

Posted: 14. Dec 2012, 18:05
by Perryg
/media/sf_share and everything is still owned by root.
This only happens if you have select to auto-mount the shared folder in the shared folder setup. You can use auto-mount but you must add your user name to the vboxsf group on the guest.

Re: automount and shared folders

Posted: 14. Dec 2012, 18:24
by mikeybikey
Hi

I was already in the vboxsf group. (I just double-checked.) I put the script in init.d like I said and disabled automount in Settings > Shared Folders and now it neither mounts at /media or at /home/mike/host. I turned off automount in Settings > Shared Folders because "share", the name for the Windows folder, always got mounted as /media/sf_share with everything owned by root so I thought the other way was the way to go. This is the script I added to /etc/init.d:

Code: Select all

#!/bin/sh
sudo mount -t vboxsf -o uid=1000,gid=1000 share /home/mike/host
I'm completely out of ideas now. Help!

Thanks very much in advance.

Best regards,
Mike

Re: automount and shared folders

Posted: 14. Dec 2012, 18:41
by Perryg
Give me a bit (I'm in the middle of something) and I'll load up my F16 and see what is going on.

Re: automount and shared folders

Posted: 14. Dec 2012, 21:00
by Perryg
OK sorry but I was deep in it with another project.

Your init script is not correct and you need to set run levels and then run /sbin/chkconfig to have it in the proper rc.d

I did a quick search for you http://unix.stackexchange.com/questions ... rt-at-boot

Re: automount and shared folders

Posted: 15. Dec 2012, 00:00
by mikeybikey
Hi Perry

Thanks very much for that. I kind of got part of the way to what you suggested. My previous init.d script was clearly inadequate. I've done about what I can do for today but I'll try to put a proper script together tomorrow and get back to you.

Just one question though. From what I've read you are supposed to use various commands to establish the Knn and Snn symlinks in the rcX.d directories or will the init script mechanism take care of that itself?

Thanks very much for your continuing help.

Best,
Mike

Re: automount and shared folders

Posted: 15. Dec 2012, 00:05
by Perryg
You know I don't hold too much with standards, never believed in them.

The main thing you need is a proper header and the command. Use what ever you want in the run levels and it will work.
Keep in mind these scripts run at run level so you don't need the sudo and I usually use bash myself.

I'll send you a pm with some generic things but this in no way a VirtualBox issue so not going to post to public.

Re: automount and shared folders

Posted: 15. Dec 2012, 01:33
by mikeybikey
Thanks Perry

That would be great and thanks for the answer about chkconfig setting the run levels.

Best regards,
Mike