TurnKey Linux Virtual Appliance Library

How to connect to Windows share from TKL

Windows native filesharing uses a protocol/filesystem known as SMB/CIFS. Samba can provide access to this from Linux (and OSX). The TKL Fileserver and PDC appliances include Samba by default so this should work OOTB. For other TKL appliances you will need to install the smbfs package (which is a component of Samba).

To install:

apt-get update
apt-get install smbfs

To mount the share you'll need to make a folder for the share to be mounted in and mount it:

mkdir /media/win-share
mount -t cifs //WinPC/share username=Win-user,password=pass,workgroup=WORKGROUP /media/win-share

Where '/media/win-share' is the absolute path to the local folder where the share will be mounted, 'Win-PC' is the IP (or resolvable hostname) of the Windows machine hosting the share you wish to access, 'share' is the share name, 'Win-user' is the username of the Windows user who has the desired level of access/permission to the share, 'pass' is their password and 'WORKGROUP' is the PC's workgroup. Depending on your Win PC setup, you may not need to include the workgroup of the Win PC. If you are accessing a public Windows share then the username, password and workgroup can all be replaced with 'guest'. To check that the share has been mounted as expected have a look in /media/win-share:

ls /media/win-share

You should find the contents of your Windows share there, ready to go!

Auto mount on boot

SMB/CIFS share can be set up to automount on boot of your TKL appliance. You should probably only do this if the share will always be available. A common scenario would be while running TKL virtualised on a Desktop/Laptop (eg in VirtualBox).

Open fstab for editing:

nano /etc/fstab

At the bottom of the file add the line:

//WinPC/share /media/win-share cifs username=Win-user,password=pass,workgroup=WORKGROUP 0 0

If you are using non-English filenames then ',iocharset=utf8,codepage=unicode,unicode' should also be added.

To double check that it all should work (without rebooting) use the 'mount -a' command.