How to mount synology SMB2 share on ubuntu

21,478

I use a PI to mount a DS Share into my nextcloud instance. For that reason I use the following mounting command:

sudo mount.cifs -o username=ds-user,password=pw-of-ds-user,uid=33,gid=33,file_mode=0660,dir_mode=0770,vers=2.1  //IP-of-NAS/share /mountpoint/where/to/mount

I will explain the command

  • username and password should be clear I hope
  • uid gid are the values for www-date to get it working under nextcloud
  • file_mode set the permission for the mounting point
  • dir_mode do the same for folders
  • vers=2.1 that was the most important to get it working, the version 2.0 was not working for my DS in combination with my Linux
  • and of course the the source and destination

So you cannot copy and paste my command you must edit it to your needs, but I think the structure should be clear now.

Share:
21,478

Related videos on Youtube

wouter205
Author by

wouter205

Updated on September 18, 2022

Comments

  • wouter205
    wouter205 over 1 year

    I'm having a hard time mount a SMB2 share from my synology to ubuntu server 16.04.

    mount.cifs //NAMEOFNAS.domainname.local/Backup /mnt/NAS/ -U USERNAME
    

    results in following error:

    mount error(95): Operation not supported
    

    So checking the network share with smbclient results in another error:

     smbclient //NAMEOFNAS.domainname.local/Backup -U username
    WARNING: The "syslog" option is deprecated
    Enter username's password:
    protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE
    

    When doing the same but with a share on Windows server, I have no problem whatsoever. Is there something I have to configure in Synology NAS (i noticed it's configured to only use SMB2)?

    Here is the output of testparm (only thing I changed was domain and security=user)

       # Global parameters
    [global]
            workgroup = AVR
            server string = %h server (Samba, Ubuntu)
            server role = standalone server
            security = USER
            map to guest = Bad User
            obey pam restrictions = Yes
            pam password change = Yes
            passwd program = /usr/bin/passwd %u
            passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
            unix password sync = Yes
            syslog = 0
            log file = /var/log/samba/log.%m
            max log size = 1000
            server max protocol = SMB2
            max protocol = SMB2
            protocol = SMB2
            server min protocol = SMB2
            min protocol = SMB2
            dns proxy = No
            usershare allow guests = Yes
            panic action = /usr/share/samba/panic-action %d
            idmap config * : backend = tdb
    
    
    [printers]
            comment = All Printers
            path = /var/spool/samba
            create mask = 0700
            printable = Yes
            browseable = No
    
    
    [print$]
            comment = Printer Drivers
            path = /var/lib/samba/printers
    

    What can I do to mount this share please?

    kr, wouter

    • ob2
      ob2 about 6 years
      Some track : can you try mouting with IP address of the Synology. Also try without the FQDN (e.g. //NAMEOFNAS/Backup). I also guess that correct option for username is -o username=username
    • wouter205
      wouter205 about 6 years
      @olivierb2 I did make a mistake in my post, I corrected the syntax of smbclient´. When I try it with -o username=username´ it results in the same `NT_STATUS_INVALID_NETWORK_RESPONSE´ error. Uising the NETBIOS or the IP address does not make a difference.
  • wouter205
    wouter205 about 6 years
    Hi, thanks for sharing your input. I needed to change version to `vers=2.0´ in order to get it working. I'll take a look which settings for uid gid will fit me but for now it's working. Thanks!
  • wouter205
    wouter205 about 6 years
    Sorry, I was a bit to quick. mount.cifs is working now but I need to add it to /etc/fstab´ to mount it at boot. I added the following line //IPADDRESSNAS/Backup/ /mnt/backup/ cifs credentials=/home/ncadmin/.smbcredentials,file_mode=0660,dir‌​_mode=0770,vers=2.0´ but receive following error in DMESG: `CIFS VFS: Unknown vers= option specified: "2.0"´
  • WiKrIe
    WiKrIe about 6 years
    I use it for several mounts in fstab with the following syntax: //server/share /mount/to cifs vers=2.1,credentials=/home/user/.smbcreds,uid=1001,gid=1001,‌​iocharset=utf8,rw I dont know why exactly but I thought vers flag must be the first one. could you please try it.
  • WiKrIe
    WiKrIe about 6 years
    and now I was to quick I simple transfer my bash script into fstab from my PI and then I mount it via mount -a //192.168.178.200/photo /mnt/remote/nas/photo cifs username=username,password=password,uid=33,gid=33,file_mode=‌​0660,dir_mode=0770,v‌​ers=2.1 what kind of Synology did you use? I'm wondering that my synology works with 2.1 and yours with 2.0 ...
  • WiKrIe
    WiKrIe about 6 years
    I have an idea, normally you would run your cron under root, and maybe your smbcred file is under user xy, so 2 options, first try to insert user and password directly into fstab, if those works create a new smbcred file under root with the account.
  • wouter205
    wouter205 about 6 years
    You have good ideas :-). Indeed, with user+pw directly in fstab it worked. Now I have done chown root:root .smbcredentials and mounting works as a charm! Here is the line: //NAMEOFNAS.domain.local/Backup/ /mnt/Backup/ cifs vers=2.0,credentials=/home/admin/.smbcredentials,file_mode=0‌​600,dir_mode=0600 Thanks!
  • Denilson Sá Maia
    Denilson Sá Maia almost 4 years
    Note: it is possible to configure Synology DSM to have Maximum SMB protocol = SMB3, which means the vers=2.1 will not be needed anymore.