CIFS mount with Synology Diskstation and LDAP

I tried to mount a SMB share from a synology disk station, which uses LDAP for account storage. It failed:

$ smbclient -u cweiske \\\\server\\sharename
Enter cweiske's password:
Domain=[SOME] OS=[Unix] Server=[Samba 4.1.18]
tree connect failed: NT_STATUS_ACCESS_DENIED

It began to work when I edited /etc/samba/smb.conf:

[global]
client plaintext auth = yes
client lanman auth = yes
client ntlmv2 auth = no

But I wanted this in my /etc/fstab, too. Unfortunately mount.cifs does not read smb.conf, but you can set the options via its proc configuration:

$ echo 0x00030 > /proc/fs/cifs/SecurityFlags
$ mount /path/to/mount
.. works

See the Kernel CIFS filesystem documentation.

I put the echo command into /etc/rc.local so that it gets auto-applied after reboots.

Written by Christian Weiske.

Comments? Please send an e-mail.