백곡시스템

Linux):: Mounting a Synology SMB share on Ubuntu 18.04 using CIFS

출처: https://www.benmctee.com/2018/09/mounting-synology-smb-share-on-ubuntu.html

I recently purchased a Synology DS918+ and an Intel NUC to replace my aging (and quite large) desktop machine. I wanted the same ease of access as my previous setup where I used an mdadm RAID array mounted to /mnt/Media. I knew that in order to achieve direct access, I’d need to update /etc/fstab, but how? Try to Google “synology smb mount ubuntu” and see the wide array of results.

I transferred some (4) of the desktop hard drives that were part of the RAID array to the NAS. After a day of setting it up, initializing the drives, creating the volume, and getting my Plex server going, it was time to start transferring data from my cloud backup. Once that was complete, I started my research and eventually came up with a proper fstab solution that’s working for me.

Ultimately it came down to this:

  1. In your Synology DSM, go to Control Panel > File Services
  2. Check Enable SMB Service
    1. Make the Workgroup whatever you want (ie HOMENAS)
    2. Check ‘Disallow access to Previous Versions’
  3. Go to Advanced Settings
    1. WINS server: leave blank
    2. Maximum SMB protocol: SMB3
    3. Minimum SMB protocol: SMB2
    4. Transport encryption mode: Auto
    5. Check ‘Enable Opportunistic Locking’
    6. I left everything else unchecked
  4. Click Apply on Advanced, and Apply on the main SMB configuration screen
  5. It should look similar to this:
    Synology SMB configuration screen
  6. Over on your Ubuntu machine, create a new mounting destination and change the ownership to your login:
    1. sudo mkdir /mnt/Media
    2. sudo chown <username>:<groupname> /mnt/Media
  7. Create a credentials file in your home directory
    1. nano ~/.smbcredentials
    2. username=<synologyUsername>
      password=<synologyPassword>
    3. Save and exit (Ctrl+X, y, enter)
  8. Change the permissions of that file so that you and root are the only users that can access it:
    1. chmod 0600 ~/.smbcredentials
  9. Edit /etc/fstab to mount it automatically:
    1. sudo nano /etc/fstab
    2. At the bottom of the file, make a similar entry:
      1. # Credentials file should be 0600 permissions with the following format:
        # username=<SynologyUsername>
        # password=<SynologyPassword>
        ##############################
        # Media on HomeNAS:
        //homenas.local/Media /mnt/Media cifs credentials=/home/<username>/.smbcredentials,vers=3.0,uid=1000,gid=1000 0 0
      2. //homenas.local/Media is the network name of your NAS, followed by the shared directory on the NAS
      3. /mnt/Media is the directory you just created on the local machine
      4. vers=3.0 enforces the latest version
      5. The uid=1000,gid=1000 mounts it as your login
    3. Save the file and exit (Ctrl+X, y, enter)
  10. Test the mount by mounting all entries in fstab:
    1. sudo mount -a
    2. If you received no errors, then you’re good to go, and can access this folder at /mnt/Media
    3. Check the permissions to make sure they make sense:
      1. ls -al /mnt
      2. This should show your username and group as the owner
  11. Create symlinks as desired or Nautilis shortcut by dragging it into the left column

Special thanks to this post, which ultimately is what I needed to get going.

댓글 남기기

Close Menu