Map a Windows Share in Linux


Linux has 2 files that contains the mount points:

  • /etc/mtab is a file maintained by the Operating system and should not be touched.
  • /etc/fstab is a file where we can place all the mappings you would like to create

Both are loaded when the operating system starts, and as shown later , can be mounted manually.

In order to map a Windows share in a Linux OS, follow these steps:

Create the container

For a regular Windows user it may sound strange, but in order to make a map in Linux, we first must create the container/folder to have the mapped data in.

I would usually prefer to create mapped folders under /mnt folder but it can be anywhere.

so to create a folder, I will type:

mkdir /mnt/WinFolder

Create the map itself

Open the file for edit (I’m using nano text editor)

nano /etc/fstab

Add a line to the bottom of the file
The syntax of the map should be like:

//WinServerName/ShareName  /Path/To/The/Folder ShareType username=WinUserName,password=WinPassword 0  0 

Or in our case

// /mnt/files cifs  username=*****,password=********* 0  0 

Save the file and exit (CTRL-X)

Apply the changes

Simply type in

mount -a

and press enter

That’s it , change folder to the mount point and you will see the content of the shared folder.

Leave a comment

You must be logged in to post a comment.