Mount a Windows Share Folder As a Drive
For most purposes, the built-in features of Nautilus to browse and mount smb shares will suffice. But in some cases, such as when you wish the folder to be automatically mounted, or need to have another application read from the folder, it needs to be mounted differently.
In my case, some of my music happens to be in a shared folder on a Windows server. I use Amarok to play my music, and so unless I have the shared folder mount automatically, and in a regularly accessible location, problems ensue with accessing the music through Amarok.
Fortunately, this is a relatively fix - despite the length of time it took me to discover how. First, the format of the fstab
entry.
//Server_Name/Share_Name /location/to/mount cifs password=,uid=Your_User 0 0
Now for the break down:
-
Replace Server_Name with either the domain name of the server that has the share, or its IP. Personally, the server I’m mounting from is on the intranet, and has a static IP address, so I just use that. Make sure to use the two forward slashes at the start of the line. For this part, and the share name, if you need to see the name and have Samba set up and configured, you can look up both with the Network browsing feature of Nautilus (and if you use Gnome).
-
Replace the Share_Name with the name of the share you want to mount.
-
Replace /location/to/mount with the location you wish to mount the folder to. Remember that if there are any contents in the folder you mount to, they will be inaccessible until the share is unmounted.
-
cifs simply tells fstab what file system type it is mounting. CIFS mounts Samba shares.
-
The next section may require changes. If the share can be freely accessed, that is to say without password and username, the current configuration should do just fine. However, if you will be required to enter username and password, using the following setup instead
username=smb_user,password=the_password,uid=Linux_Username
. In this configuration, you enter your credentials for the Samba network, but the uid stays the same. The uid, in either configuration, should be set to your username on the machine you are working from. This gives you read/write access to the mounted drive.
The first zero allows a backup program to check to see if that drive should be backed up. In most cases, as now, you most likely will want it to be zero.
The second zero tells fsck not to check the drive. This is the preferred option here, as the server should be doing the checking, not the client.
Now, to make sure that you have configured fstab correctly, run the command mount -a
as root. This will attempt to mount all entries in fstab.