Samba share is not mounting with normal user rights

I am using the below script and trying to mount the samba mount with normal user with domain permission but always i am getting error saying “mount.cifs: permission denied: no match for /home/ found in /etc/fstab”


Get the logged-in username


Create the directory if it doesn’t exist

mkdir -p “/home/${username}/xxx_mnts/oudata/xxx_PROJECTS”

chown -R “${username}”:“domain users” “/home/${username}/xxx_mnts/oudata/xxx_PROJECTS”

chmod -R 755 “/home/${username}/xxx_mnts/oudata/xxx_PROJECTS”

#Add user to the mount group

sudo usermod -a -G mount ${username}

Get the UID and GID of the user

uid=$(id -u “$username”)

gid=$(id -g “$username”)

Construct the mount command

mount_command=“mount.cifs //oudata/xxx_PROJECTS /home/${username}/pfx_mnts/oudata/xxx_PROJECTS/ -o _netdev,username=${username},,uid=${uid},gid=${gid},sec=krb5,vers=2.1”

Mount the directory using the mount.cifs command

eval “$mount_command”

Check the exit status of the mount command

if [ $? -eq 0 ]; then

echo “Mount command executed successfully.”


echo “Mount command failed.”


Please help to find what i am doing wrong

OK, first thing is that the username is ‘’, are your usernames in this format ?
Unless you have changed something, mount must be run by root or with sudo.

What works for me between two Samba Unix domain members is:

sudo mount -t cifs // /srv/smb_share -o cruid=username,user=username,sec=krb5i,uid=11104,gid=10513

Where ‘data_share’ is the share on the FQDN server ‘’ which is mounted into ‘/srv/smb_share’ locally.

Thanks for the reply!!! Please find my reply below
“OK, first thing is that the username is ‘’, are your usernames in this format? I have edited this place to avoid exposing my domain. And I forgot to mention that with sudo and root access, the said script is working well, but it is not helping me to gain the folder access policy from my AD.”---- SO trying to mount the shares using the direct user permission which is not happening

I realised that you had sanitised the command, but is the username being set to ‘’ (that is the UPN) ?
I can logon using ‘DOMAIN\username’ , ‘username’ and ‘username@dns.domain.tld’, but this is using Samba without sssd.
The sample mount command I posted is a working example, just sanitised.

Hi Thank you for your support and i wan to inform you that i have successfully mounted with proper permission using the script as sssd properly configured. Thanks for github co pilot which helped me in fixing the same