Kubuntu 20.04.4 LTS – Mount Domain Samba Shares

cifsdomainfstabsambaUbuntu

I have been trying to mount a simple share. All domain users should have read permissions. Kubuntu was configured for domain, I can see domain and log in with domain user. When I access shares with Dolphin file manager I can successfully open and browse them (Network -> Shared Folders (SMB) -> Add the folder).

I have tried several commands to mount this: mount -t cifs, mount.cifs, fstab + mount-a, …
All with no success. dmesg says: (I also got error -22, but idk exact setup at that time)

[ 9478.459984] CIFS: fs/cifs/connect.c: VFS: leaving cifs_get_smb_ses (xid = 330) rc = -13
[ 9478.459986] CIFS: fs/cifs/dfs_cache.c: __dfs_cache_find: search path: \DOMAIN\files
[ 9478.459989] CIFS: fs/cifs/dfs_cache.c: get_dfs_referral: get an DFS referral for \DOMAIN\files
[ 9478.459993] CIFS: fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0x0000000058c5ce4f/0x00000000c6989c97)
[ 9478.459998] CIFS: fs/cifs/connect.c: VFS: leaving mount_put_conns (xid = 329) rc = 0
[ 9478.459999] CIFS: VFS: cifs_mount failed w/return code = -13

With command, password gets accepted:

root@HOSTNAME:/mnt# sudo mount -t cifs -o username=user.name@DOMAIN '\\DOMAIN\files' /mnt/DOMAIN/X
Password for user.name@DOMAIN@\DOMAIN\files:  *****************       
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

Shares are reachable:

root@HOSTNAME:~# smbclient -U user.name@DOMAIN -L \\\DOMAIN\\files                                                                                                                                          
Enter user.name@DOMAIN's password: 

        Sharename       Type      Comment
        ---------       ----      -------
        ...
        ...
        Files           Disk      
        ...
        ... 
        ... 
        ...      
SMB1 disabled -- no workgroup available

This does not work:

root@HOSTNAME:~# smbclient -k -U user.name@DOMAIN -L \\\DOMAIN\\Files
gensec_spnego_client_negTokenInit_step: gse_krb5: creating NEG_TOKEN_INIT for cifs/DOMAIN failed (next[(null)]): NT_STATUS_INVALID_PARAMETER
session setup failed: NT_STATUS_INVALID_PARAMETER

I have found some posts saying I need keyutils:

root@HOSTNAME:/mnt/4TB# apt list ---installed | grep keyutils
keyutils/focal,now 1.6-6ubuntu1 amd64 [installed]
libkeyutils1/focal,now 1.6-6ubuntu1 amd64 [installed,automatic]

fstab:

#/etc/fstab
//DOMAIN/files  /mnt/DOMAIN/X  cifs  credentials=/home/user.name@DOMAIN/.credentials/samba,file_mode=0644,dir_mode=0755,iocharset=utf8,sec=ntlmssp,vers=2.1,rw 0 0
# I have tried vers=1.0, vers=2.0, vers=2.1, no vers

Not beeing able to mount simple samba share makes me feel very silly 🙂 I hope I am doing something that is very obviously wrong.


EDIT: I have changed some stuff and got a different dmesg output:

user.name@DOMAIN@hostname:[~]$ sudo mount -a
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
[86121.898379] CIFS: Attempting to mount \\DOMAIN\files
[86121.901569] CIFS: VFS: \\DOMAIN\files DFS capability contradicts DFS flag
[86121.903442] CIFS: VFS: cifs_mount failed w/return code = -22

Fstab:

//DOMAIN/files  /mnt/DOMAIN/X  cifs  credentials=/home/user.name@DOMAIN/.credentials/samba,file_mode=0644,dir_mode=0755,nounix,iocharset=utf8,sec=ntlmssp,vers=2.1,rw 0 0

Best Answer

Ok, so I figured out what the problem is. Shares are behind DFS and this caused problems.

https://www.geeksforgeeks.org/what-is-dfsdistributed-file-system/

A Distributed File System (DFS) as the name suggests, is a file system that is distributed on multiple file servers or multiple locations. It allows programs to access or store isolated files as they do with the local ones, allowing programmers to access files from any network or computer.

Fstab:

//MACHINE.DOMAIN/some/folders  /mnt/DOMAIN/some_folder  cifs  credentials=/home/user.name@DOMAIN/.credentials/samba,uid=USER_ID,gid=GROUP_ID,file_mode=0644,dir_mode=0755,nounix,iocharset=utf8,sec=ntlmssp,vers=2.0,rw 0 0

Mounting directly from PC that has the share, works perfectly. I know this is not the solution, but works really great as a workaround.

Related Question