permanently mount Samba version 4 share on linux

0

I want to permanently mount a Samba share on a newly set-up Linux Mint 20.1 system. I'm running Samba version 4.10 on FreeNAS 11.3.

I can mount in the current session by running in the terminal (from this manual):

sudo mount -t cifs //net-host/share /mnt/share -o user=user,password=mypw,domain=lan

To permanently mount the drive I tried editing the etc/fstab file. I added the following line (from this manual):

//net-host/share /mnt/share cifs username=user,password=mypw, 0 0 

and saved fstab.

And then in terminal:

(base) user@machine:~$ sudo mount -a
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
(base) user@machine:~$ dmesg | tail
...
[ 3680.727542] CIFS: Attempting to mount //net-host/share
[ 3680.727561] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[ 3680.751016] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[ 3680.751027] CIFS VFS: \\freenas Send error in SessSetup = -13
[ 3680.751040] CIFS VFS: cifs_mount failed w/return code = -13
(base) user@machine:~$ 

We've tried many other options in the fstab file:

  • vers=1.0, yields the following error in the dmesg log:
[ 4583.692974] CIFS VFS: cifs_mount failed w/return code = -95
  • vers=2.0, or vers=3.0, yields the following error in the dmesg log:
[ 4666.975227] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[ 4666.975235] CIFS VFS: \\freenas Send error in SessSetup = -13
[ 4666.975250] CIFS VFS: cifs_mount failed w/return code = -13
  • vers=4.0, yields the following error in the dmesg log:
[ 4888.934509] CIFS VFS: Unknown vers= option specified: 4.0
  • sec=ntlm, yields the following error in the dmesg log:
[ 4160.566932] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[ 4160.587967] CIFS VFS: Unable to select appropriate authentication method!
[ 4160.587970] CIFS VFS: \\net-host Send error in SessSetup = -22
[ 4160.587989] CIFS VFS: cifs_mount failed w/return code = -2
  • uid=1002,:
[ 5923.542766] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[ 5923.566847] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[ 5923.566857] CIFS VFS: \\freenas.local Send error in SessSetup = -13
[ 5923.566868] CIFS VFS: cifs_mount failed w/return code = -13
  • uid=1002,vers=1.0,:
[ 6195.633461] CIFS VFS: cifs_mount failed w/return code = -95
  • x-systemd.automount, vers=3.0,:
[ 6504.718290] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[ 6504.718298] CIFS VFS: \\freenas.local Send error in SessSetup = -13
[ 6504.718309] CIFS VFS: cifs_mount failed w/return code = -13
  • dir_mode=0777,file_mode=0777,vers=3.0,:
[ 6623.955689] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[ 6623.955700] CIFS VFS: \\freenas.local Send error in SessSetup = -13
[ 6623.955717] CIFS VFS: cifs_mount failed w/return code = -13

We've tried different ways of accessing the server by changing the line in the fstab file:

  • by IP: //192.168.0.XX/share /mnt/share cifs username=user,password=mypw,vers=1.0, 0 0
[ 5465.946197] CIFS VFS: cifs_mount failed w/return code = -95
  • with .local: //net-host.local/share /mnt/share cifs username=user,password=mypw,vers=1.0, 0 0
[ 5848.179532] CIFS VFS: cifs_mount failed w/return code = -95
mount
linux-mint
samba
ubuntu-10.04
asked on Super User May 3, 2021 by Joooeey

1 Answer

0

Turns out the password was spelled wrong.

So inserting either of the following lines in fstab will work:

//net-host/share /mnt/share cifs username=user,password=mypw 0 0 

or

//net-host/share /mnt/share cifs credentials=/home/user/.smbcredentials 0 0 

with a file .smbcredentials with the following contents:

username=user
password=mypw

No other options need to be specified. In fact for me it didn't work when setting sec=ntlm.

P.S. Make sure to replace net-host, share, mnt with the appropriate file paths and make sure your username and password are spelled right.

answered on Super User May 3, 2021 by Joooeey

User contributions licensed under CC BY-SA 3.0