# Samba share is not mounting with normal user rights

**URL:** <https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-8, rocky-linux-9\
**Created:** [May 14, 2024, 11:16am UTC](https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046 "2024-05-14T11:16:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![boopathyt](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@boopathyt](https://forums.rockylinux.org/u/boopathyt)\
**Post date:** [May 14, 2024, 11:16am UTC](https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046/1 "2024-05-14T11:16:30Z")

</div>

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/xxxx@yours.com/xxx\_mnts/cdata/xxx\_PROJECTS found in /etc/fstab”

#!/bin/bash

# Get the logged-in username

username=$(whoami)

# 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},[domain=xxx.com](http://domain=xxx.com),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.”

else

echo “Mount command failed.”

fi

Please help to find what i am doing wrong

---

<div class="post-metadata">

**Author:** ![hortimech](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@hortimech](https://forums.rockylinux.org/u/hortimech)\
**Post date:** [May 14, 2024, 1:51pm UTC](https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046/2 "2024-05-14T13:51:58Z")

</div>

OK, first thing is that the username is ‘xxxx@yours.com’, 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 [//testdm.samdom.example.com/data\_share](https://testdm.samdom.example.com/data_share) /srv/smb\_share -o cruid=username,user=username,sec=krb5i,uid=11104,gid=10513

Where ‘data\_share’ is the share on the FQDN server ‘[testdm.samdom.example.com](http://testdm.samdom.example.com)’ which is mounted into ‘/srv/smb\_share’ locally.

---

<div class="post-metadata">

**Author:** ![boopathyt](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@boopathyt](https://forums.rockylinux.org/u/boopathyt)\
**Post date:** [May 14, 2024, 3:18pm UTC](https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046/3 "2024-05-14T15:18:18Z")

</div>

Thanks for the reply!!! Please find my reply below  
“OK, first thing is that the username is ‘xxxx@yours.com’, 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

---

<div class="post-metadata">

**Author:** ![hortimech](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@hortimech](https://forums.rockylinux.org/u/hortimech)\
**Post date:** [May 14, 2024, 4:30pm UTC](https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046/4 "2024-05-14T16:30:10Z")

</div>

I realised that you had sanitised the command, but is the username being set to ‘xxx@yours.com’ (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.

---

<div class="post-metadata">

**Author:** ![boopathyt](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@boopathyt](https://forums.rockylinux.org/u/boopathyt)\
**Post date:** [May 29, 2024, 11:40am UTC](https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046/5 "2024-05-29T11:40:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [July 28, 2024, 11:41am UTC](https://forums.rockylinux.org/t/samba-share-is-not-mounting-with-normal-user-rights/14046/6 "2024-07-28T11:41:06Z")

</div>

Closed on July 28, 2024, 11:41am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
