2 minute read

In an effort to make my life easier and be able to access my files securely and easily I’ve set up my linux box to be able to read the window shares that I have running on my main box. This may not always be the setup I’ll have – but it is for now.

My linux box is a headless system that is setup without a GUI, and accessible through SSH, and on the same home network as my windows computer. On the windows computer I currently have a few shares available – though I will just be demonstrating with one share in this tutorial.

First, to see what shares are available, we run a command with smbclient:

smbclient -L 192.168.100.50

L simply lists the shares it finds, and here I just use the IP address of the machine I am looking at.

It will produce some output like this:

Domain=[HOME] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

Sharename       Type      Comment
---------       ----      -------
Complete        Disk
E$              Disk      Default share
IPC$            IPC       Remote IPC
D$              Disk      Default share
I$              Disk      Default share
G$              Disk      Default share
L               Disk
ADMIN$          Disk      Remote Admin
H$              Disk      Default share
C$              Disk      Default share
J$              Disk      Default share

In this case I wish to mount the L drive,  so I use the following command, where -t cifs is specifying the common internet file system, then we have the network path to the share, -o specifies options which are the username and password, and lastly the place we want to see the share (which is a folder that we’ve already created on the linux box) :

mount -t cifs //192.168.100.50/L -o username=owner,password= /home/user/winbox/L

So now that I have the share up and running, I can make it stick around permanently by editing fstab. I am a vi person, but just fire up your favourite editor like as follows:

vi /etc/fstab

At the bottom of the file we insert the following line, where we have the network path, the mount path, file system, username/password (_netdev so that it holds off trying to mount until the network is established), and 0 0  for the dump and fsck so that both ignore the mounted path:

//192.168.100.50/L /home/user/winbox/L cifs username=owner,password=,_netdev 0 0

Once we have that edited, we need to make sure the system will still survive a reboot by testing the mounts:

mount -a

And with that, it looks good to go. I can now SSH into this box from another pc somewhere else in the world, and with an application like winSCP I can pull files down to view them.

Other things that may be useful if you are stuck:

mount man page

how to edit fstab