How do I automatically mount my shared folder?

Discussions about using Linux guests in VirtualBox.

Postby Ozzie » 27. May 2008, 18:05

Clod! wrote:Thanks mate,
it works: the shared directory is now mounted automatically on boot... but unfortunately is read only (only root can write). :(

Is there any solution for making it writable for "normal" user?

Thanks.
Clod!

My system:
Host: Win XP Pro
Guest: Ubuntu 8.04
VirtualBox: 1.6.0


Hi, before trying the above solution, you might first want to check the permissions on the folder *without* being mounted on, that is, the folder over which you will be mounting the other filesystem on, a good suggestion would be 1777 (sticky bit on) as it allows everyone to write on it but only the owner to delete something.
Anyway, the mounted fs will have 'inherit' the permissions from the folder it is mounted on, so maybe you just need to changed it. Beware, once a fs is mounted on a folder, you wont 'see' neither what was on that folder nor the "original" permissions for that folder, you'll only 'see' the files and permissions in the mounted fs.

hope this helps.
Ozzie
 
Posts: 8
Joined: 18. Apr 2008, 04:36

Postby Clod! » 28. May 2008, 11:38

Thanks lot and Ozzie for the suggestions. ;)

Here is what i've tried from scratch today:
1) make the mount point /home/share. That is created with these properties:
Code: Select all   Expand viewCollapse view
drwxr-xr-x  2 root    root    4096 2008-05-28 10:56 share


2) change the permissions on it using chmod 1777 /home/share
Code: Select all   Expand viewCollapse view
drwxrwxrwt  2 root    root    4096 2008-05-28 10:56 share


3) modify the /etc/fstab in the following way:
Code: Select all   Expand viewCollapse view
Condivisa   /home/share   vboxsf   rw,uid=1000,gid=1000,auto   0   0


4) after the restart of the system the mount point has the normal user as owner:
Code: Select all   Expand viewCollapse view
drwxrwxrwx  1 claudio claudio    0 2008-05-28 10:51 share


5) the mount command shows up:
Code: Select all   Expand viewCollapse view
Condivisa on /home/share type vboxsf (uid=1000,gid=1000,rw)


6) open the directory as normal user; I can create an empty file or with something using for example echo "something" > temp or copy an existing file from another directory

Unfortunately I still can't modify any file it using for example gedit as normal user.

Kinda weird...
:(
Clod!
 
Posts: 2
Joined: 26. May 2008, 16:21

Postby Ozzie » 28. May 2008, 22:55

well.. yes, is indeed kind of wierd ... now we still need to check the exported filesystem .. it also should be exported/shared so eveyone can use it, not only root, I think the shared filesystem only allows root by default.... check the man for the share command in your unix operating system... I think it is the last resource I can think of to share with you... if something comes to my mind, I´ll update this post ...
regards
Ozzie
 
Posts: 8
Joined: 18. Apr 2008, 04:36

Postby cwl157 » 12. Jun 2008, 06:06

yes finally it worked for me. The one gotcha that i am going to point out because i think its easy to miss. In the modules you write vboxvfs

notice the placement of the fs

then in fstab you write

vboxsf

notice the sf , they look very similar but they are actually 2 different things. I don't know maybe im the only one that didn't notice that right away but it gave me some problems so maybe it is giving someone else some problems too.
cwl157
 
Posts: 14
Joined: 20. Mar 2008, 02:07

Postby Stumpy842 » 14. Jul 2008, 04:28

@clod, try this line in fstab:

Condivisa /home/share vboxsf rw,uid=1000,gid=1000,auto,exec 0 0
Stumpy842
 
Posts: 1
Joined: 14. Jul 2008, 04:25

unknown filesystem type 'vboxfs'

Postby joseph85750 » 24. Oct 2008, 18:59

JackH wrote:I ran into the same problem with Slackware 12 -- a share will mount via the command line, but not in fstab.

I overcame this by placing the mount command in the rc.local file. This is where the VirtualBox installer placed its commands also, which I suppose is why mounting via fstab doesn't work -- the rc.local script has not been executed when fstab does its thing.


Something else worth mentioning-- I had problems getting the:
# mount -t vboxsf <sharename> /mountpoint to work. I kept getting the error:

mount: unknown filesystem type 'vboxsf'

I figured I needed to install the guest additions, but wasn't very clear how to do this in slackware. The Devices/Install-Guest-Additions... didn't do anything. I tried mounting up the ISO in my WinXP host, but it didn't do anything when I tried to Install Guest Additions (no errors). But on the Slackware guest, I found:

/opt/VirtualBox-2.0.4/additions/VBoxGuestAdditions.iso

So, I mounted it:

# mount -t iso9660 -o loop /opt/VirtualBox-2.0.4/additions/VBoxGuestAdditions.iso /mnt

Then, in /mnt

# sh VBoxLinuxAdditions-x86.run

This created my /sbin/mount.vboxsf

I was then able to:

# mount -t vboxsf <sharename> /mountpoint

Hopefully this will help others!
joseph85750
 
Posts: 10
Joined: 16. Apr 2008, 06:44

Re: How do I automatically mount my shared folder?

Postby jimbagsh » 11. Oct 2009, 17:37

Wow, took me all day checking every forum using just the right search words to find this post. Thank you.

8th step: Go to the folder /etc
9th step: Use your favorite editor to open the file "modules" of this folder. Be sure you have root rights, otherwise you could maybe not be able to save it. You could for example use the command "sudo gedit modules".
10th step: After the last line you write now vboxvfs and in the next line vboxadd. Then save save and close this file.
11th step: Now open the file fstab which is contained in the same folder. Again open it with root-rights, so you are able to save your changes.
12th step: After the last line you write now:
NameOfTheSharedFolderInVirtualbox NameOfYourMountFolderInLinux vboxsf defaults 0 0
in my file it looks approximately like this:
exchange /home/someuser/someos vboxsf defaults 0 0


In the 10th step, there is a typo - should read "vboxsf" instead of "vboxfs"

The line I added to fstab looked like this to give me full rights:
Jim /home/computer/Host vboxsf uid=1000,gid=1000 0 0

Thanks again..... Jim
VirtualBox 3.0.8 - Host OSX Snow Leopard - Guest Ubuntu 9.4 - on MacBook 3,1
jimbagsh
 
Posts: 2
Joined: 11. Oct 2009, 17:23
Primary OS: Mac OS X other
VBox Version: OSE Debian
Guest OSses: Ubuntu

Re: How do I automatically mount my shared folder?

Postby Sasquatch » 11. Oct 2009, 22:49

jimbagsh wrote:Wow, took me all day checking every forum using just the right search words to find this post. Thank you.

8th step: Go to the folder /etc
9th step: Use your favorite editor to open the file "modules" of this folder. Be sure you have root rights, otherwise you could maybe not be able to save it. You could for example use the command "sudo gedit modules".
10th step: After the last line you write now vboxvfs and in the next line vboxadd. Then save save and close this file.
11th step: Now open the file fstab which is contained in the same folder. Again open it with root-rights, so you are able to save your changes.
12th step: After the last line you write now:
NameOfTheSharedFolderInVirtualbox NameOfYourMountFolderInLinux vboxsf defaults 0 0
in my file it looks approximately like this:
exchange /home/someuser/someos vboxsf defaults 0 0


In the 10th step, there is a typo - should read "vboxsf" instead of "vboxfs"

The line I added to fstab looked like this to give me full rights:
Jim /home/computer/Host vboxsf uid=1000,gid=1000 0 0

Thanks again..... Jim
VirtualBox 3.0.8 - Host OSX Snow Leopard - Guest Ubuntu 9.4 - on MacBook 3,1

Why all that trouble if you could use my Howto: Use Shared Folders? And to kick a year old topic too, not the best way actually. It wouldn't have hurt to open a new topic for it. Still, glad you found this, not everyone finds what they are asking, while it's been discussed before :).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: How do I automatically mount my shared folder?

Postby jimbagsh » 16. Oct 2009, 05:27

Thanks for the reply Sasquatch. Sorry, I didn't realize the last post before me was over a year old. New to forums and thought that as long as a topic is open, it was better to add to it instead of starting a new topic. Guess it's all a learning process.

The part that I had difficulty with was knowing which etc/ files to edit. That step is not explained in any detail (but probably has too many variations depending on OS) in the How To. That's why I found the information in this topic very helpful.

I tried to figure a way to tell the Ubuntu: VirtualBox Documentation folks about it but not sure on that either.

Thanks again. I don't know what I would do without these forums online. Definitely makes life easier.
jimbagsh
 
Posts: 2
Joined: 11. Oct 2009, 17:23
Primary OS: Mac OS X other
VBox Version: OSE Debian
Guest OSses: Ubuntu

Re: How do I automatically mount my shared folder?

Postby Sasquatch » 16. Oct 2009, 11:48

Forums sure make computers easier. My howto doesn't mention fstab, or only briefly, because that file is parsed before any additional modules are loaded, like the vboxsf module. It usually makes the mount fail. That's why I note /etc/rc.local. The user won't know the difference, because rc.local is done at the end of the boot process and that's before the user logs on. Not all distributions have /etc/rc.local, so they need to consult the documentation to know which script is run as a last step.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: How do I automatically mount my shared folder?

Postby ilead7 » 11. Dec 2009, 16:30

i followed Telcontars directions and it worked for xubuntu 9.10 thank you :)
ilead7
 
Posts: 1
Joined: 11. Dec 2009, 16:19
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: xubuntu 9.10

Re: How do I automatically mount my shared folder?

Postby Tom-H-PIC » 12. Jan 2010, 04:30

I followed Telcontars directions and it worked the first time right out of the box on ubuntu 9.10.
I'm new to Linux so I will give some fast pointers on how I got there.
These pointers may be simple for a veteran Linux user but this info was hard for a new guy to find.
Step 7 to make folder with make directory
"sudo mkdir /home/username/foldername" usename is you the user of the system foldername is the name of the new folder you're going to use for the share in the Ubuntu file structure.
Step 8 change directory with "cd /etc/"
Ok this is the big one that was hard for me to find.
Step 9 edit the files using this command in the terminal
"gksudo gedit /etc/filename" use the files names for listed
in Telcontars how to post.

With the above changes I follow all of Telcontars step and it work the first time it was outstanding!
Thanks Telcontars this help was outstanding. :mrgreen:
Tom-H-PIC
 
Posts: 1
Joined: 1. Jan 2010, 04:22
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu

Re: How do I automatically mount my shared folder?

Postby Fulkabaster » 3. Apr 2011, 17:46

The same problem. Running VBox (4.0.0) in Win7, the guest is openSuSE11.3. Guest additions installed, shared folders are mounted manually without problem (except that requires to log into root). There is an appropriate line in fstab, but this line is just perfectly ignored. As someone commented here, also there should be lines "vboxvsf" and "vboxadd" in the file /etc/modules. Well, I didn't find this file there, but I have created one and put those line into it. Again, no reaction.

How can I make this damned mounting occurring automatically at boot?
Fulkabaster
 
Posts: 1
Joined: 3. Apr 2011, 17:40
Primary OS: MS Windows 7
VBox Version: OSE Fedora
Guest OSses: SuSE10.3

Re: How do I automatically mount my shared folder?

Postby elizabethpwalker » 13. May 2011, 22:53

i have the same problem as Fulkabaster on Windows 7. can anyone give some advice?
elizabethpwalker
 
Posts: 2
Joined: 13. May 2011, 22:49
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu

Re: How do I automatically mount my shared folder?

Postby Perryg » 13. May 2011, 23:22

If you are using version 4.0.* of VirtualBox you really should not have an issue. Simply use the auto-mount for the shared folder.
The only additional requirement (aside from the guest additions) is your user name must be in the vboxsf group on the Linux guest. You can achieve this with the following:
In a host terminal run this:
Code: Select all   Expand viewCollapse view
sudo usermod -aG vboxsf <your username>

Replace <your username> with the name you use to log in. Type your user password when prompted.

Then the next time you reboot the guest the share will show in /media/sf_<share_name>
If you want this in a different folder just symlink it to where ever you want.
Perryg
Site Moderator
 
Posts: 34373
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

PreviousNext

Return to Linux Guests

Who is online

Users browsing this forum: Bing [Bot] and 18 guests