Unable to mount SMB share with cifs command line

I cannot figure out how to mount SMB shares from the Linux command line. I am able to get to them using Nautilus on Linux and Windows machines. So, I’m assuming that my permissions are correct. I’ve tried specifying anywhere from minimal options to tons of options, but I always get mount error(13): Permission denied. Permissions are backed by a domain controller. What am I missing?
Here are some things that I’ve tried.

mount -o username=user,domain=domain.lan,iocharset=utf8,sec=ntlmssp -t cifs // /mnt --verbose
mount -o vers=3,uid=22104,gid=20513,username=user,password=password,domain=domain.lan,iocharset=utf8 -t cifs // /mnt --verbose

You specified --verbose, what output do you get?

Probably not the cause but I prefer to mount to some directory I created beforehand /mnt/somedir.
I don’t specify domain in my credentials file for /etc/fstab

These are your UID and GID? Did you confirm with id -u and id -g?

From my perspective

mount -t cifs -o uid=22104,gid=20513,username=user,password=password,iocharset=utf8 // /mnt/XOABackup 

should work.

1 Like

You are trying to mount a share to a different system, right? Not to TN itself, right??

The primary goal in trying to get this to work is as a backup target for my xcp-ng hypervisor. I was getting errors when trying to set this up in XOA. So I switched to poking at it in the command line on my desktop.


sudo mount -o vers=3,uid=22104,gid=20513,username=xoabackup,password=password,domain=domain.lan,iocharset=utf8 -t cifs // /mnt --verbose
mount.cifs kernel mount options: ip=,unc=\\\XOABackup,vers=3,iocharset=utf8,uid=22104,gid=20513,user=xoabackup,domain=domain.lan,pass=********
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

dmesg doesn’t seem to provide anything useful.

[91094.037222] CIFS: Attempting to mount //
[91094.066760] CIFS: Status code returned 0xc000006d STATUS_LOGON_FAILURE
[91094.066785] CIFS: VFS: \\ Send error in SessSetup = -13
[91094.066826] CIFS: VFS: cifs_mount failed w/return code = -13

I did an id for the user on TrueNAS to get the uid and gid.

@Davvo I run TN Core on dedicated bare metal. I’ve tried mounting the share from a VM and from my desktop machine with the same results.

The uid and gid in the mount.cifs command refers to the local user (on the client.)

Your uid and gid are likely 1000 and 1000.

Thanks for clarifying that. I was thinking that was the ids on the remote machine. Unfortunately, using it properly doesn’t change the result.

Hi @mouseskowitz any update on this?
I want to mount the SMB into an Ubuntu VM and I also get the permission problem… From my Windows computer works, so the user and permisions should be fine…
The command I’m running is sudo mount -t cifs //<ip>/raid /mnt/RAID -o username=<user>,file_mode=0777,dir_mode=0777

You also get permission denied?

remove the file_mode and dir_mode parts, mount without sudo and you’re missing the password=PASSWORD part.

I mount all my shares via /etc/fstab, I added the entry

//TRUENASIP/SMBSHARENAME /mnt/remote/SMBSHARENAME cifs credentials=/etc/.truenas_creds,iocharset=utf8,uid=1000,gid=1000,x-systemd.automount

the file .truenas_creds contains 2 lines:

me@ubuntuserver:~$ ls -l /etc/.truenas_creds
-rw------- 1 root root 37 Mar  4  2023 /etc/.truenas_creds

If you want to manually mount you should be able to just use username=<user>,password=<password> arguments as shown before in this thread.

So either,

a) modify your /etc/fstab file and then mount -a
b) use

mount -t cifs -o //TRUENASIP/SMBSHARENAME /mnt/remote/SMBSHARENAME cifs username=USERNAME,password=PASSWORD,iocharset=utf8,uid=1000,gid=1000

@chuck32 thanks for the reply. Neither of both methods you provided work…

Also, the second method should be mount -t cifs //TRUENASIP/SMBSHARENAME /mnt/remote/SMBSHARENAME -o username=USERNAME,password=PASSWORD,iocharset=utf8,uid=1000,gid=1000

I’m using TrueNAS SCALE 23.10.2

@rogermiranda1000 nope. I gave up and ended up using NFS. I would prefer to have authenticated users, but I’ll settle for IP based.

Running sudo smbclient -L //<ip> -A /etc/.truenas_creds with /etc/.truenas_creds:


Also returns session setup failed: NT_STATUS_LOGON_FAILURE.

(just in case you need this)

Hostname: truenas
Domain: local
Workgroup: WORKGROUP

I was able to mount it, by launching a second SMB app (so it’s not the best solution…)

If you want to do it:

  1. Create the app

On TrueNAS, add a “custom application”. Set the image dperson/samba, and add all this commands: /sbin/tini, --, /usr/bin/samba.sh, -p, -u, <user>;<password>, -s, <dir>;/mnt/<dir>;no;no;no;<user>. You’ll have to set also the environment variables USERID=<user_id> and GROUPID=<group_id>. Add a port forwarding of the TCP port 445 to 9300, and then all the storage you want to share.

  1. Setup the linux

Install the dependencies: sudo apt-get install cifs-utils

Create a file /etc/.truenas_creds with the following:


Then, add a new line at /etc/fstab:

//<ip>/<dir> /mnt/<dir> cifs rw,relatime,user,credentials=/etc/.truenas_creds,iocharset=utf8,file_mode=0777,dir_mode=0777,x-systemd.automount,port=9300 0 0

Finally, run mount -a