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 derivatives, such as Mediaserver, Torrentserver) and Domain Controller appliances include Samba by default so this should work OOTB. For other TKL appliances you will need to install the cifs-utils package - which is a component of Samba.

To install:

apt-get update
apt-get install cifs-utils

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.

Comments

Kevin's picture

root@mytklcontainer /mnt# apt-get install smbfs

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package smbfs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  cifs-utils

E: Package 'smbfs' has no installation candidate
Jeremy Davis's picture

Hi Kevin, yes it is very out of date! Thanks for noting that.

As noted in the message you received, the new package to install now is 'cifs-utils'. I've updated the page and AFAIK it should be correct now. If not, please let me know and I'll look a little closer.

PS I've enabled your user account now, so please feel free to start a new thread if you wish.