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.
- 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.
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.
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.
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
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