Code

Mounting a Samba Share in Debian GNU/Linux

Samba allows a computer running GNU/Linux to connect with and share files with a computer over a Microsoft Windows based network.

To mount a drive or folder that is shared over Samba or over a Windows based
network as a drive on your computer there are three steps:

  • install cifs-utils;
  • create a mount point on your system where the folder is to be mounted; and
  • mount the shared folder.

The first step is to install cifs-utils, which is a “protocol provides support for cross-platform file sharing with Microsoft Windows, OS X, and other Unix systems”.

As root, use:

# apt-get install cifs-utils

Next is to create a mount point where the shared folder will be mounted. This
can be any folder. To make a new folder, as root, use:

# mkdir /netfiles/music

The final step is to mount the shared drive using the “mount” command. The type of file system to be mounted will be specified as “cifs”, to use the cifs-utils protocol.

The standard form for the mount command is

"mount -t <type> <device> <directory>"

For example, lets say there is music shared over a local home network. If the folder is shared with the name “music” from a computer which has an IP address of 192.168.X.XX, this will be the information of the “device”, namely the item to mount. The “directory” is the mount point that has been created on the GNU/Linux computer. As an extra option you can put in your username that is needed to connect.

The command used to mount will be:

# mount -t cifs //192.168.X.XXX/music //netfiles/music -o username=XXX

This work by Clinton Pavlovic is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.