Tag Archives: cifs

Network drives without samba [cifs]

  1. The problem of smb://
  2. Method 1 – without fstab
  3. Method 2 – Using fstab

The problem of smb://

Samba is useful but many programs are not able to handle SMB protocol at a URI. I keep facing problems when using it.

A more compatible way to use network drives is to map them with mount_cifs to a local path. Then all programs will be able to handle files from the network drives. However, the default configuration is that only root user can mount file systems. So it can get a little bit tricky.

Method 1 – without fstab

This method is practically useful only for the current session and it is not permanent. The path is mounted only for the current session. However it is a convenient way to test the network communication.

Firstly, find the user id you are using via the command:

id

Let’s say that the commend returns the number 1000. Then mount the filesystem with the following command:

sudo mkdir /mnt/d
sudo mount.cifs -o rw,username=bob,password=bobpass,uid=1000 //server.local/path /mnt/d

Check that everything is okay. If so you can proceed to the next step to make the changes activate on boot

Method 2 – Using fstab

If you want to have the drives mapped after each reboot then:

  1. chmod +s /sbin/mount.cifs
  2. chmod +s /sbin/umount.cifs
  3. chmod 600 /etc/fstab

Note: In the recent version of Mint, the permissions above are already set correctly, so most probably you can skip the steps above. But it is better to verify the permissions anyway.

Now lets assume that the server is myserver.local

Then, for each share do the following:

  • mkdir /media/localpath
  • nano /etc/fstab
  • add the following line:

//myserver.local/server_path /media/localpath cifs username=u,password=p,uid=1000,iocharset=utf8,vers=3,users 0 0

And you are ready.

You should replace u with the username, p with the password and 1000 your UID. Also use a different localpath for each directory you want to mount.