LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Qemu-kvm file sharing Linux host Xp guest problems (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/qemu-kvm-file-sharing-linux-host-xp-guest-problems-808364/)

Linux.tar.gz 05-17-2010 11:16 AM

Qemu-kvm file sharing Linux host Xp guest problems
 
Hi.

I use a Slack64 13.0 as host and Xp "pro" as guest.

I tried many ways to share /media folder, in order to get instant access to usb keys, but i always failed.

1- Using the -smb switch, my 2 Xp crashes randomly.

2- Using a real samba share, users can't write in /media/usbkey because it's rw-r-r (don't want Xp users to enter any login/password). By the way i found impossible to change to rw-rw-rw /media/* . If someone knows how i can achieve this i'll be happy.

3- Using a ftp, firefox can read the share, but filezilla nor ftp included in Xp can list the files :/ weird.

4- Don't want to use nfs, because one of my Xp is fat32 formated.

5- Don't want to use the direct usb connect from qemu, because it must be simple for users.

I spent days before realizing my only hope is to post my question here.

mostlyharmless 05-18-2010 02:12 PM

Quote:

Using a real samba share, users can't write in /media/usbkey because it's rw-r-r (don't want Xp users to enter any login/password). By the way i found impossible to change to rw-rw-rw /media/* . If someone knows how i can achieve this i'll be happy.
Something with "force create mode" or "force directory mode" perhaps? See the following:

http://www.linuxquestions.org/questi...-saved-800859/

Gerard Lally 05-18-2010 04:00 PM

Quote:

Originally Posted by Linux.tar.gz (Post 3971585)
Hi.

I use a Slack64 13.0 as host and Xp "pro" as guest.

I tried many ways to share /media folder, in order to get instant access to usb keys, but i always failed.

1- Using the -smb switch, my 2 Xp crashes randomly.

2- Using a real samba share, users can't write in /media/usbkey because it's rw-r-r (don't want Xp users to enter any login/password). By the way i found impossible to change to rw-rw-rw /media/* . If someone knows how i can achieve this i'll be happy.

3- Using a ftp, firefox can read the share, but filezilla nor ftp included in Xp can list the files :/ weird.

4- Don't want to use nfs, because one of my Xp is fat32 formated.

5- Don't want to use the direct usb connect from qemu, because it must be simple for users.

Do the Windows users have accounts on the Slackware system? As far as I know users must be members of the plugdev group in order to access removable media. Usually you assign a user to this group when running the adduser script. I imagine that unless the Windows guests have an account on the Slackware server, and unless they are members of the plugdev group, they won't be able to access the USB memory stick, no matter what permissions you grant guest users in smb.conf. The underlying Linux permissions need to be fixed first, and to my mind that means any user wanting to access removable media needs to be a member of the plugdev group, which means he also needs to be a user on the Slackware server. Unfortunately for you it probably also means your Windows users will need to authenticate to the Samba server with a username and password. I could be completely wrong of course but this seems to me the problem.

I presume you also have writeable = yes under your [media] section in your smb.conf?

Don't forget as well that directories need the executable bit set - your rw-rw-rw- would not allow users to drill down through folders on the removable media. It would need to be rwxrwxrwx I think.

mostlyharmless 05-18-2010 04:12 PM

Well, the XP users have to enter a password to logon to XP, so that can almost certainly be automatically passed to the samba network share for authentication without need for additional typing. If so, there shouldn't be a problem adding them as users to the Slackware system as members of plugdev..

Linux.tar.gz 05-20-2010 08:19 AM

This doesn't work :
force create mode = 0660
force directory mode = 0770

neither
writeable = yes

There's no authentication in XP

I can't change permission for /media/KINGSTON its drwxr-xr-x
I made a thread about this specific problem :
http://www.linuxquestions.org/questi...5/#post3971465

Linux.tar.gz 11-18-2010 09:33 AM

Yay !

Created /etc/udev.d/11-media-by-label-auto-mount.rules

Here's the content :

KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"

# Global mount options
ACTION=="add", ENV{mount_options}="relatime,users"
# Filesystem specific options
ACTION=="add", PROGRAM=="/sbin/vol_id -t %N", RESULT=="vfat|ntfs-3g", ENV{mount_options}="$env{mount_options},utf8,gid=100"
ACTION=="add", PROGRAM=="/sbin/vol_id --label %N", ENV{dir_name}="%c"
ACTION=="add", PROGRAM!="/sbin/vol_id --label %N", ENV{dir_name}="usb-%k"
#ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options},umask=000,users /dev/%k /media/%E{dir_name}"
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o rw,noauto,users,umask=000,iocharset=utf8 /dev/%k /media/%E{dir_name}"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
LABEL="media_by_label_auto_mount_end"

--------------EDIT :
Seems umounting doesn't work properly.
I'm playing around with two systems and i'm a bit confused by now. Anyway this is a huge step.

Linux.tar.gz 11-23-2010 05:57 AM

Installed pmount, and changed /etc/udev.d/11-media-by-label-auto-mount.rules for using pumount instead of umount.

Now it works.


All times are GMT -5. The time now is 11:56 PM.