Mounting smb (samba) shares with fstab

Forum Forums General Tips and Tricks Mounting smb (samba) shares with fstab

  • This topic has 1 reply, 2 voices, and was last updated Aug 4-1:18 pm by olsztyn.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #86857
    Member
    dirkd

      For a long time now I have been using the /etc/fstab file to mount shared folders on my NAS when booting. In combination with a few symbolic links in my home folder, I find this a very convenient and flexible way to organize my filesystem tree. Yesterday however I experienced some problems with my Synology NAS, and in the course of solving them, an upgrade of the NAS OS from DSM6 to DSM7 was made. The result was that my shared folders on the NAS were no longer mounted. The error messages I saw were not very informative, and even downright confusing. It took some googling to find out how to remedy this problem, so I decided to put it on the forum, in case someone is interested.

      To mount a share //<NAS>/<SHARE> at (e.g.) /mnt/<MNT-point> every time I boot up the system, I include the following line in my /etc/fstab file.

      //<NAS>/<SHARE> /mnt/<MNT-point> cifs user=<NAME>,password=<PASSWD>,vers=2.0,iocharset=utf8,sec=ntlmsspi 0 0

      In the line above, <NAS> is the host name of the server, <SHARE> the name of a shared folder on that server, <NAME> is a user-account on that server (who – of course – must have sufficient rights on that shared folder) and <PASSWD> the password (on the server) associated with the account <NAME>. The parameter ‘vers=’ specifies the version of the SMB-protocol used for the communication between client and server machine, while ‘sec=’ specifies the security method that is being used. Before the upgrade to DSM7, I used the parameter ‘sec=ntlm’, which no longer works. Apparently, security has been tightened on the new version of Synology’s OS.

      For this to work the package cifs-utils must be installed.

      Keep in mind that /etc/fstab is readable, so if security is a concern, you should replace the ‘user=’ and ‘password=’ parameters with ‘credentials=<PATH-TO-TXT-file>’, and write the ‘user=’ and ‘password=’ parameters on separate lines in that text-file, that only you can read. (I didn’t try this however).

      There’s another useful trick to mount a share ‘on the fly’. Open the file manager and type the following in the address bar:

      //<NAME>:<PASSWD>@<NAS>/<SHARE>

      The share is then mounted in a subfolder of /media/, automatically created by the system. This folder is also automatically removed when unmounting the folder (right-click on it in the menu >Devices and choose [Unmount] in the context menu). If you omit the part :<PASSWD> from the address bar, you are prompted for the password of <NAME> on the server. This works on SpaceFM, but should work on zzzFM as well.

      • This topic was modified 9 months ago by dirkd.
      • This topic was modified 9 months ago by dirkd.
      #86861
      Member
      olsztyn
        Helpful
        Up
        0
        ::

        I have been using the /etc/fstab file to mount shared folders on my NAS

        Nice write-up. Thanks.
        I am also using fstab to map shares on my NAS boxes. However since I do not need all NAS shares all the time, I am just mounting what I need. For each NAS box I have entries in fstab, such as one of them as example:

        //192.168.0.5/files /home/demo/S cifs username=francis,noauto,user 0 0

        When I do need any of SMB shares I mount them:

        mount S

        It asks for password and SMB share is mounted as S in my home folder.
        I found fstab way to mount shares very simple.

        Live antiX Boot Options (Previously posted by Xecure):
        https://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.