permission of shared directory

Discussions about using Linux guests in VirtualBox.

permission of shared directory

Postby Vallverdu » 18. Apr 2008, 20:30

Hi !

I have a question about shared directory. I have a windows host and i installed a linux (redhat 5) guest.

I installed also the guest additions. Then i created a shared directory. And my problem is that only the root can write in the shared directory. Then I have to do a change user (su) before copy a file from the guest into the shared folder.

Do you know how i can change this ?

Thank you
Vallverdu
 
Posts: 19
Joined: 12. Dec 2007, 14:40
Location: Paris (Orsay)

Postby Sasquatch » 19. Apr 2008, 00:00

You can change this by changing the mount options. Read the man page of mount for the syntax of the options. You need to specify the uid and gid of your user with the mount options. If you mount the shared folder directly in your home folder, you shouldn't have these problems. However, I have seen it where there was a folder in my home that only root could access. This was the driver for my printer which I ran as root. With the uid and gid options, it will all work just fine. Don't forget to use either defaults, or the options you need too. 'man mount' is your friend. Read it carefully.
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

Postby Vallverdu » 20. Apr 2008, 17:35

Thank you

I mount the shared folder into my home directory and it is ok. But when i closed the root terminal it does not work any more.

I read the mount's man but i am not famous in linux and i don't understand how i have to do to specify the uid and gid of my user. If you know that can you say it to me ?

Thanks
Vallverdu
 
Posts: 19
Joined: 12. Dec 2007, 14:40
Location: Paris (Orsay)

Postby Sasquatch » 20. Apr 2008, 19:43

The GID and UID depends on your user and setup. Some have 1000 as GID and UID, others have a different number. You can check this by typing 'cat /etc/passwd' in a terminal. Find your username and there should be a number on that line. That is your UID. The GID is often the same, but to be certain, use 'cat /etc/group'. I'm not certain that it actually lists your usergroup.
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

Postby Vallverdu » 20. Apr 2008, 21:14

I know the user number and the group number. I chosed their when i install the OS because each user at my laboratory has a defined group and user id.

But i don't know the syntax ...

thank
Vallverdu
 
Posts: 19
Joined: 12. Dec 2007, 14:40
Location: Paris (Orsay)

Postby Sasquatch » 20. Apr 2008, 22:14

Oh, the syntax is really easy. There is a field where you set the options, it's comma separated, so use it like this:
Code: Select all   Expand viewCollapse view
mount -t vboxsf sharefolder /point/to/mount -o user,uid=1000,gid=1000,exec,rw
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

Postby Vallverdu » 21. Apr 2008, 10:57

I do not write user because it says that it is not a good option.

So i juste write

Code: Select all   Expand viewCollapse view
mount -t vboxsf test /home/Ger/common/ -o uid=749,gid=201,exec,rw


The name of the group and the owner are good. If I do an ls -l in the command line I see my name and my group name. But I can't write or delete anything in the folder.
Vallverdu
 
Posts: 19
Joined: 12. Dec 2007, 14:40
Location: Paris (Orsay)

Postby Sasquatch » 21. Apr 2008, 12:14

Did you set the SF to be writable? There is a checkbox that makes it read only, clear that. If that does not work, I have no idea what is the problem, it could be a bug. I don't have Linux as a Guest system, so I can't check it.
Also, the reason I added user to the options, is that the user who mounted the system can unmount it. With users, everyone can unmount the mount. If you put it in your fstab, it should load automatically.
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

Postby Vallverdu » 22. Apr 2008, 09:54

First thank you a lot for your help !

Did you set the SF to be writable?


I created a new folder in my home directory. If I do a ll command I see that this directory is :

Code: Select all   Expand viewCollapse view
drwxr-xr-x


Is it good ?

Also, the reason I added user to the options, is that the user who mounted the system can unmount it. With users, everyone can unmount the mount. If you put it in your fstab, it should load automatically


For this I need some precision. First I mount the shared folder when I am root. Is it ok ? The system said me that only root can use mount !

Second what I have to put in my fstab ?

Thanks
Vallverdu
 
Posts: 19
Joined: 12. Dec 2007, 14:40
Location: Paris (Orsay)

Postby Sasquatch » 22. Apr 2008, 13:29

The SF is default writable. For the fstab entry, that is about the same as what you type for mounting it manually. Mounting it is indeed a root task, but with the uid and gid options, it looks like you mounted it, not root ;). Look for the right context in fstab for the entries that are already in there, and of course the man page.
It would be something like this:
Code: Select all   Expand viewCollapse view
#Entry for Shared Folder:
sharefolder /mount/point/for/sf vboxsf auto,users,exec,rw,uid=1000,gid=1000 0 0


I did find that on my XP VM, SF is not perfect either. I have 2 VMs with XP, one crashes when I use it with a BSOD, the other can't open files correctly or write them. There is still a lot of work to be done to get it working fine.
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


Return to Linux Guests

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests