4

I have attempted to mount a windows share using the following line in my fstab:

//some_mount /media/some_mount cifs uid=1000,gid=1000,credentials=/home/quant/.smbcredentials,sec=ntlm 0 0

When I run sudo mount -a the /media/some_mount directory is correctly mounted. I can also see that the permissions for the directories are correct (ie. my user has read/write permission). However, when I try to enter one of the directories I get the following error:

-bash: cd: some_mount/dir/: Operation not permitted

If I first run sudo -i and run that same command as root, everything works.

I have tried running id -g quant and id -u quant and confirmed that my gid and uid are both 1000.

Why can't I access those directories as the non-root user?

1
  • 2
    You say your user has read/write permission. However, to enter a directory you need execute permission. Do you have that? – terdon Nov 25 '16 at 11:53
2

As @terdon points out you need execute permissions to traverse a directory. Check the permissions on the mount point /media/some_mount in your example. I'll use /mnt for my example

$ ll /mnt
total 20
drwxr-xr-x  5 root root 4096 Oct 24 01:42 ./ 

You'll note that while only the owner (root in my example) has write permissions and both the group (root in my example) and everyone else has read and execute permissions meaning anyone can see the contents of and traverse the directory. chmod is the key to setting permissions. After determining how the permissions are currently set, adjust them according to your requirements. For details on how to do this see the man chmod page. If you need further guidance, drop me a comment and I'll do what I can to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.