SUSE Conversations


Sharing Files Between a VMware Guest and SUSE Linux Host Using Samba



By: ldagair

February 19, 2009 6:35 pm

Reads:1033

Comments:0

Rating:0

When using VMware server, an easy way of sharing files between a Windows guest and a SUSE Linux host would be to set up a Samba server on the SUSE Linux host.

The smbd and nmbd daemons provide file sharing, print sharing, name resolution and browsing services to clients. Using YaST we can make sure that the relevant Samba packages are installed on the Linux host.

  • samba
  • samba-client
  • samba-winbind
  • yast2-samba-client
  • yast2-samba server

Configuring the Samba server

If the yast2-samba server package is installed, YaST can be used to configure the Samba server. In the YaST control center under Network Services category, the Samba Server option will launch the screens necessary to configure the workgroup and shares (The Samba server exports its shares into a named workgroup).

In the Identity tab, set the workgroup and NetBIOS hostname.

sambaidentity_0_0.jpg

In the Shares tab, add a new share.
Set the share name and the path to the folder on the SUSE Linux host. Make sure the share is enabled after it is added to the list of shares.

sambashares_0_0.jpg

Check the Samba server by running the findsmb command, which finds all the Samba servers on the local network.

Verify that there is a TCP endpoint listening on port 139.

netstat -ant

The smbclient command can be used to list the shares on a server.

findsmb
smbclient -N -L yourSambaServer

Setting up a user account

The default Samba security level is the User-level, where each share has a specific list of users that can access it. Samba authenticates the username and password supplied by the client against smbpasswd, which is a list of usernames and passwords that Samba maintains and is independent from /etc/passwd.

Using YaST User Management create a new Linux user account i.e. smbuser.

Only root can add new Samba accounts using the smbpasswd command. The user must already have a Linux account with the same name.

 smbpasswd -a smbuser

Then make sure the smbuser has read (and write access if you want) to the shared folder.

 chown smbuser:users /home/sharedFolder
 chmod 775 /home/sharedFolder

Access restriction -optional

In order to restrict the access to the Samba share to the Vmware guests, choose the Advanced Settings from the Identity tab in the Samba Server and add the following two options:

  • Interfaces //here list all the vmnet interfaces you have, so the Samba server will ignore all the communication from the other interfaces
  • bind interface only set to true

interfacesrestriction_0.jpg

Accessing the shares from the guest machine

Using a Network file browser you can connect to the share and authenticate as smbuser with the password set in the previous steps.

Enter a url of the form: smb://sambaserverhostname/sharename
smb://flipflopshost/myvmsharefolder

In the case where the guest is a Linux machine as well, the Samba share can be mounted into the guest’a file system (if the kernel includes SMB file system support).
You will need to add the username option as the Samba server will default to the username you are logged in as in Linux.

mount -t smbfs -o username=smbuser //flipflophost/myvmsharefolder /mnt/sambashare
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags: , ,
Categories: SUSE Linux Enterprise Server, Technical Solutions, Virtualization

Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

Comment

RSS