Accessing a Shared Folder on a Windows PC

Some years ago a friend of mine asked me to go over to his house to help him set up access to a Windows PC from an Ubuntu one. To cut a long and frustrating story short, we tried everything we could think of for an entire afternoon and still failed miserably. It was with a heavy heart then, that I turned to that same task again today.

I wanted to have access to a shared drive on a Windows XP laptop. I was amazed to find the answer after only a short period of Googling. These are the steps that I needed. The laptop in question is on a workgroup, and there is no password – it just boots straight up. It is attached wirelessly to the same network that my Ubuntu box is cabled onto.

I created a folder called davetest on the laptop & shared with read/write access. I checked that I could see it and that I had read/write access to it from another Windows laptop just to verify that the share was working. It was.

On my Ubuntu PC I opened a terminal and typed:

sudo apt-get install smbfs

As I understand it (and I’ll gleefully admit I’m no expert in this) SMB (Server Message Block) is a network protocol used to access such things as printers and shares between network nodes. The smbfs package allows Linux to interact with the SMB protocol via the Linux file system (hence smb fs).

I had to create a folder on the Ubuntu PC in the media folder on which the remote share would be mounted:

sudo mkdir /media/laptop

I then had to edit the fstab file:

sudo gedit /etc/fstab

I added the following line to the bottom of the file (note that this should all entered on one long line):

//<IP Address>/davetest /media/laptop  cifs  guest,uid=1000,iocharset=utf8,codepage=unicode,unicode  0  0

<IP Address> = IP of laptop
davetest = name of shared folder on laptop
uid = The user ID of the user who will take ownership of the mounted files

Finally I used the mount command to mount the shared folder onto the Ubuntu file system at the /media/laptop location:

sudo mount -a

I received no error messages, so I proceeded to the first and simplest test:

ls /media/laptop

This listed the files in the shared folder on the Windows laptop. I experimented further and through the usual means I verified that I could copy files to the location, delete files and change files. The new file system location was accessible through the terminal windows and through Nautilus.

Windows Shared Folder in Terminal
Windows Shared Folder in Terminal
Windows Shared Folder in Nautilus
Windows Shared Folder in Nautilus

Makes me wonder what the deuce we were doing all those years ago, and why it was such an epic failure.

Tags : , , ,

7 thoughts on “Accessing a Shared Folder on a Windows PC”

  1. Ok I have a desktop with Ubuntu 12.04 on it, want to share folders out on it..ok easy enough, however, I have someone that will only use Windows 7. Mapping Ubuntu to Ubuntu I can do, but I need to know how to have “Folder Whatever” (from Ubuntu) Mapped on a Windows System.

    Thanks for your time


  2. I have Ubuntu Server 12.04.1 64 bit system with ubuntu desktop installed. However, I want to browse windows network folder via terminal. I followed your instruction but the command root@myserver:~#mount -a gives me the following error message: mount error (13) : permission denied
    Refer to the mount.cifs(8) manual page (e.g man mount.cifs)

  3. I was able to mount and access my windows share folder by adding username option. Mount will prompt for my windows login password and the mounting was successful and I was able to browse and create file.

    Thank you very much for your tutorial

  4. None of the above worked for me, but they did finally point me in the right direction after many false attempts with other apps. This worked instead:
    Set up windows local network from xp by following network setup wizard.
    Changed rules of the firewall used on windows (privatefirewall) to allow sharing within local network, adding router IP address & subnet mask, and ubuntu laptop IP address, to trusted local sites in the firewall list.
    Changed permission of windows folders to allow access within local network.
    Files could then be accessed without password or username from Network (on Gnome Places menu) through nautilus.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.