You are not logged in.

#1 2008-05-06 22:32:17

Jeddo
Member
Registered: 2007-08-03
Posts: 11

Qemu Samba Configuration

Hi,

I'm trying to share files between linux host and windows 2000 guest embedded with Qemu.

My aim is that each user has read-write access to his own /home/user directory both in host linux and guest windows. Despite my best efforts (and after having read many pieces of how-to's), I did not reach this goal yet. I don't know what's going wrong.

Well, here is the [qemu] part of my /etc/samba/smb.conf configuration file (it has changed a lot, but I could not get satisfaction, so it is probably (very) polluted):

[qemu]
   comment = user home directory
   path = /home/myuser
   browseable = yes
   writable = yes
   read only = no
   create mask = 0666
   directory mask = 0777
   public = yes
   guest ok = yes

Note that "/home/myuser" is not exactly what I want to get (I'd like /home/%u but it didn't work).

I wrote this very simple bash script to launch qemu:

#!/bin/bash
 
qemu -hda /home/jeddo/qemu/win.qcow \
     -drive if=ide,index=1,media=cdrom \
     -smb qemu \
     -m 160 \
     -kernel-kqemu

It is placed in /home/jeddo/qemu/launch_w2k.sh

I added an xfce4 menu entry to Emulation so that one can launch windows as a software (hu, hu) only with one click (it simply consists in calling /home/jeddo/qemu/launch_w2k.sh).

However, I can read-only files of /home/myuser by accessing \\10.0.2.2\qemu in windows.

My question is really easy (to understand): what do I have to do in order to get full read-write access?

À vot' bon cœur! wink

Offline

#2 2008-05-07 18:07:39

Jeddo
Member
Registered: 2007-08-03
Posts: 11

Re: Qemu Samba Configuration

No idea? (Or, maybe, wrong forum section?)

Offline

#3 2008-05-08 07:34:46

The_Major
Member
From: Newport, UK
Registered: 2008-03-31
Posts: 18

Re: Qemu Samba Configuration

Have a look on the Qemu Wiki, I believe you have to run qemu without the -smb option and run an smb server on the linux host first.

The wiki can be found here

http://calamari.reverse-dns.net:980/cgi … /FrontPage


Who Knows? Who Cares? Who will remember anyway?

Offline

#4 2008-05-08 08:32:42

stojic
Member
From: Zagreb, Croatia
Registered: 2008-02-24
Posts: 51

Re: Qemu Samba Configuration

I have set up a share using samba (winxp in qemu). I share ~/tmp/qemu_share.

smb.conf:

[qemushare]
path = /home/ivstojic/tmp/qemu_share
browseable = yes
writable = yes
valid users = ivstojic

You could create one share for each user, with /home/username as path and only that user in valid users. You could name those shares username1_share, username2_share and so on.

and I am starting qemu like this:

qemu-kvm -localtime -m 512 -boot c windows.img -smb /home/ivstojic/tmp/qemu_share/ -std-vga -redir tcp:2212::22 -no-acpi -soundhw es1370 hda

The relevant part is only -smb /home/ivstojic/tmp/qemu_share/, you can use -smb /home/$USER in the launch script, and have every user in windows map his share to a drive in windows using \\10.0.2.2\usernameN_share as path and his linux username and password for username and password.
Set it to remember the password in windows and drive should be mapped every time those users log in to windows.

Hope this helps.

Last edited by stojic (2008-05-08 08:43:39)

Offline

#5 2008-05-12 23:25:43

Jeddo
Member
Registered: 2007-08-03
Posts: 11

Re: Qemu Samba Configuration

I will try this, I'll let you know. Thanks.

Edit: just one question, by the way. Windows installation is single-user. Does it matter?

Last edited by Jeddo (2008-05-12 23:31:55)

Offline

#6 2008-05-24 11:43:10

Jeddo
Member
Registered: 2007-08-03
Posts: 11

Re: Qemu Samba Configuration

Finally, stojic inspired me.

In fact, there are several solutions.

1)
First, I created a directory "share" at the root and made it writable for all users, as for /tmp (except that /tmp is emptied when OS starts):

# mkdir /share
# chmod 0777 /share

For samba configuration, I put this:

[share]
   browseable = yes
   path = /share
   writable = yes
   valid user = toto titi
   create mask = 0666
   directory mask = 0777

There are two valid (linux) users toto & titi. Qemu is launched by the script "/home/toto/qemu/launch_w2k.sh":

#!/bin/bash
qemu -hda /home/toto/qemu/win.qcow \
     -drive if=ide,index=1,media=cdrom \
     -smb share \
     -m 192 \
     -kernel-kqemu

The main drawback is that the files in /share are shared by every linux users. This is because I had a unique windows user, say toto, and all files in /share created from windows belong to toto, even those created by titi.

2)
Thus, I tried to create a second windows user. But the new configuration always disappeared. I realised why: the qemu windows image was writable only by user toto. So when titi launched qemu windows image from his session, he could never write anything into windows!

So, I just made writable for all users the "win.qcow" image:

/home/toto/qemu$ chmod a+x win.qcow

After all, samba configuration can be changed to (%u is the alias for current user, see sbm.conf man page):

[share]
   browseable = yes
   path = /home/%u/share
   writable = yes
   valid user = %u

Don't forget to create ~/share folder for each user. Then create user titi in windows. The windows password for each windows user has to correspond with the password set by (not necessary with the unix password):

# smbpasswd -a <windows username>

After this, when titi launches windows with qemu, he has to open his windows session with his windows password. And he can access the share directory to \\HOSTNAME\share, where HOSTNAME is the name of the linux host (upper/lower case doesn't matter; type "hostname" in a linux console to get your linux hostname).

If you have any question, I will watch this topic.

Offline

Board footer

Powered by FluxBB