bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

cifs automount permission error

Wed Nov 28, 2018 9:41 pm

I have successfully created a cifs automount of a windows folder on my 3 B+ running raspbian stretch. I am able to copy files from the mounted folder to my pi but I get "error opening file, permission denied" when copying files to the folder.

I created the automounted folder by editing /etc/fstab with:
//192.168.1.143/temp /home/pi/Temp cifs username=mywindowsusername,password=mywindowspassword 0 0

I would appreciate any suggestions on how to resolve my permissions error.

DirkS
Posts: 9804
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: cifs automount permission error

Wed Nov 28, 2018 9:46 pm

For a start check the permissions on the Windows side. Make sure you have write permissions.

bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

Re: cifs automount permission error

Wed Nov 28, 2018 10:03 pm

DirkS wrote:
Wed Nov 28, 2018 9:46 pm
For a start check the permissions on the Windows side. Make sure you have write permissions.
Thanks for your reply. I have full read/write permissions on the windows folder and I do have full access permissions if I use smb (smb://workgroupname;username@192.168.1.143/temp/) instead of cifs access from my 3 B+.

Andyroo
Posts: 2833
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: cifs automount permission error

Wed Nov 28, 2018 10:11 pm

Try adding a version number in.

This could be:

Code: Select all

vers=3.0

vers=2.0

vers=1.0
You could also try adding the domain with

Code: Select all

domain=yourdomain
Last one would be to add the read/write flag

Code: Select all

rw
I would try this from the command line first though to save the odd reboot :lol: :roll: :lol:
Need Pi spray - these things are breeding in my house...

bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

Re: cifs automount permission error

Thu Nov 29, 2018 1:01 am

Andyroo wrote:
Wed Nov 28, 2018 10:11 pm
Try adding a version number in.
This could be:

Code: Select all

vers=3.0
vers=2.0
vers=1.0
You could also try adding the domain with

Code: Select all

domain=yourdomain
Last one would be to add the read/write flag

Code: Select all

rw
I would try this from the command line first though to save the odd reboot :lol: :roll: :lol:
Thanks for your input. sorry to say that adding the domain and rw options to my fstab entry only produced mount errors. I am unclear how to try the vers= option you suggested in your post. Perhaps you might give me an example by inserting it in my fstab entry?

User avatar
thagrol
Posts: 1464
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: cifs automount permission error

Thu Nov 29, 2018 7:14 pm

Try adding "uid=pi,gid=pi" to the mount options in your fstab. Change "pi" as needed for your user.

Windows may not be providing correct file ownership and/or permissions data so raspbian will default to root for owner and group which will affect what non-root users can do.

See

Code: Select all

man mount.cifs
for all the possible mount options.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

Andyroo
Posts: 2833
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: cifs automount permission error

Thu Nov 29, 2018 9:52 pm

Apologies I should have sId one off :!:

Code: Select all

//192.168.1.143/temp /home/pi/Temp cifs username=mywindowsusername,password=mywindowspassword,vers=1.0 0 0
as an example.
Need Pi spray - these things are breeding in my house...

bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

Re: cifs automount permission error

Mon Dec 10, 2018 7:09 am

Andyroo wrote:
Thu Nov 29, 2018 9:52 pm
Apologies I should have sId one off :!:

Code: Select all

//192.168.1.143/temp /home/pi/Temp cifs username=mywindowsusername,password=mywindowspassword,vers=1.0 0 0
as an example.
Thanks Andyroo I just saw your reply. I am able to get the windows share to automount with all of the options below by enabling Wait for Network in raspberry pi configuration. However, I am getting a permission error either copying to or copying from the windows share depending on the wording of the fstab entry.

So far I have tried the following fstab entries:
//192.168.1.143/temp /home/pi/Temp cifs username=xxx,password=xxx,uid=1000 0 0 - (yields error copy from share)
//192.168.1.143/temp /home/pi/Temp cifs username=xxx,password=xxx,uid=pi 0 0 - (yields error copy from share)
//192.168.1.143/temp /home/pi/Temp cifs username=xxx,password=xxx,vers=1.0 0 0 - (yields error copy to share)
//192.168.1.143/temp /home/pi/Temp cifs username=xxx,password=xxx 0 0 - (yields error copying in both directions)
//192.168.1.143/temp /home/pi/Temp cifs username=xxx,password=xxx rw,file_mode=0777,dir_mode=0777 0 0 - (yields error copying in both directions)

The ironic thing is that entering smb://myworkgroupname;my username@192.168.1.143/temp/ in the file manager location bar gives me full access permissions copying to and from the windows share after entering my windows password. At this point I am at a loss and would be grateful for any ideas that might resolve the permission error.

User avatar
thagrol
Posts: 1464
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: cifs automount permission error

Mon Dec 10, 2018 1:07 pm

The way I'd recommend working this out is not with fstab. Instead use "sudo mount ..." and "sudo umount ..." to save on reboots.

Once you have it working as you want, tranlate that to an fstab entry.

The gui file manager uses a completely different mechanism to mount SMB/cifs/samba shares so it's no surprise that it has different results.

Try this:

Code: Select all

sudo mount -t cifs -o username=xxx,password=xxx rw,file_mode=0777,dir_mode=0777,uid=pi,gid=pi,forceuid,forcegid //192.168.1.143/temp /home/pi/Temp
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

andrum99
Posts: 545
Joined: Fri Jul 20, 2012 2:41 pm

Re: cifs automount permission error

Mon Dec 10, 2018 5:43 pm

Bear in mind that there are two levels of permissions on the Windows side - the permissions which are set on the share itself, and the permissions which are set on the underlying files. Both need to be set to allow the remote user write access for your to actually get write access to those files over the network.

bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

Re: cifs automount permission error

Mon Dec 10, 2018 5:56 pm

thagrol wrote:
Mon Dec 10, 2018 1:07 pm
The way I'd recommend working this out is not with fstab. Instead use "sudo mount ..." and "sudo umount ..." to save on reboots.

Once you have it working as you want, tranlate that to an fstab entry.

The gui file manager uses a completely different mechanism to mount SMB/cifs/samba shares so it's no surprise that it has different results.

Try this:

Code: Select all

sudo mount -t cifs -o username=xxx,password=xxx rw,file_mode=0777,dir_mode=0777,uid=pi,gid=pi,forceuid,forcegid //192.168.1.143/temp /home/pi/Temp
Thanks thagrol for your reply. Sorry to say that using your code suggestion yielded a mount --help response from terminal and did not mount my windows share. I am able however to mount the share using

Code: Select all

sudo mount -t cifs -o username=xxx,password=xxx //192.168.1.143/temp /home/pi/Temp
but I am getting the same permission error that I got with the fstab entry.

bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

Re: cifs automount permission error

Mon Dec 10, 2018 6:29 pm

andrum99 wrote:
Mon Dec 10, 2018 5:43 pm
Bear in mind that there are two levels of permissions on the Windows side - the permissions which are set on the share itself, and the permissions which are set on the underlying files. Both need to be set to allow the remote user write access for your to actually get write access to those files over the network.
Thank you andrum99 for replying. The windows user account and password referenced in the sudo mount commands and the fstab entries from my previous post is the shared folder owner and has full read/write control of the folder and it's contents. If that were not the case, why would smb://myworkgroupname;my username@192.168.1.143/temp/ in the file manager location bar gives me full access permissions copying to and from the windows share after entering my windows password?

User avatar
thagrol
Posts: 1464
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: cifs automount permission error

Mon Dec 10, 2018 7:42 pm

bctf1 wrote:
Mon Dec 10, 2018 5:56 pm
Thanks thagrol for your reply. Sorry to say that using your code suggestion yielded a mount --help response from terminal and did not mount my windows share. I am able however to mount the share using

Code: Select all

sudo mount -t cifs -o username=xxx,password=xxx //192.168.1.143/temp /home/pi/Temp
but I am getting the same permission error that I got with the fstab entry.
I think the mount error is due to a typo I made. Sorry. It should have been a "," between "password=xxx" and "rw" not a space. Corrected version:

Code: Select all

sudo mount -t cifs -o username=xxx,password=xxx,rw,file_mode=0777,dir_mode=0777,uid=pi,gid=pi,forceuid,forcegid //192.168.1.143/temp /home/pi/Temp
If that doesn't work, try removing options from the right until you find out which one breaks it.

If the above mount works but you still have permission issues, can you provide the following:
  • The OS on your Pi.
  • The version of said OS
  • Confirmation that your OS is up to date (sudo apt update && sudo apt upgrade for raspbian)
  • The version of windows you're using.
  • When the share is mounted but giving permission errors, the output of
My gut feeling is that there is a difference in mount options between the gui file manager and the various mount commands but I've no idea how to get at the ones the file manager is using to compare them. From a similart thread I was involved in, the file manager uses something called gio mounts, not something I'm familiar with as I don't use the gui.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

Re: cifs automount permission error

Mon Dec 10, 2018 9:31 pm

thagrol wrote:
Mon Dec 10, 2018 7:42 pm
I think the mount error is due to a typo I made. Sorry. It should have been a "," between "password=xxx" and "rw" not a space. Corrected version:

Code: Select all

sudo mount -t cifs -o username=xxx,password=xxx,rw,file_mode=0777,dir_mode=0777,uid=pi,gid=pi,forceuid,forcegid //192.168.1.143/temp /home/pi/Temp
If that doesn't work, try removing options from the right until you find out which one breaks it.

If the above mount works but you still have permission issues, can you provide the following:
  • The OS on your Pi.
  • The version of said OS
  • Confirmation that your OS is up to date (sudo apt update && sudo apt upgrade for raspbian)
  • The version of windows you're using.
  • When the share is mounted but giving permission errors, the output of
My gut feeling is that there is a difference in mount options between the gui file manager and the various mount commands but I've no idea how to get at the ones the file manager is using to compare them. From a similart thread I was involved in, the file manager uses something called gio mounts, not something I'm familiar with as I don't use the gui.
This sudo mount command successfully mounted the windows share. I can copy to the share fine but I get a screen when trying to copy from the share that says "File operation is in progress". It displays the file name and the destination folder. This window does not go away, has to be manually closed and the file copy does not complete. Also, the share cannot be unmounted and it reports that it is "Busy". However, if I reboot the Pi, the copied file is in the destination folder and is readable.

Here is the info you requested:
The OS & version on your Pi. - PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)", NAME="Raspbian GNU/Linux", VERSION_ID="9", Linux raspberrypi 4.14.79-v7+

Confirmation that your OS is up to date (sudo apt update && sudo apt upgrade for raspbian) - updated daily

The version of windows you're using. windows 10 pro

Here is the terminal output you requested:
ls -ld /home/pi/Temp:
drwxrwxrwx 2 pi pi 28672 Dec 10 13:18 /home/pi/Temp

ls -lda /home/pi/Temp/*:
output listed the complete contents of the mounted Temp share folder

mount|grep /home/pi/Temp (after share is mounted):
//192.168.1.143/temp on /home/pi/Temp type cifs (rw,relatime,vers=default,cache=strict,username=brad,domain=,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.1.143,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1)

User avatar
thagrol
Posts: 1464
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: cifs automount permission error

Mon Dec 10, 2018 11:01 pm

bctf1 wrote:
Mon Dec 10, 2018 9:31 pm
This sudo mount command successfully mounted the windows share. I can copy to the share fine but I get a screen when trying to copy from the share that says "File operation is in progress". It displays the file name and the destination folder. This window does not go away, has to be manually closed and the file copy does not complete.
Was this in the gui file manager? If so, I don't know what else to suggest as I don't use it.
Also, the share cannot be unmounted and it reports that it is "Busy".
That's usually because linux/raspbian thinks there is a file open on it or a process has it's working directory somewhere in the share (e.g. you have a terminal open and are in a directory in the share, or possible have it open in file manager). The "lsof" (list open files) command might help with troubleshooting that.

And, as you probably know, the unmount has to be done by root or with sudo.
However, if I reboot the Pi, the copied file is in the destination folder and is readable.
No idea about that, sorry.
Here is the info you requested:
Thanks, with the mount command working there's nothing I need there. For future reference when trying to debug this sort of thing, it would have been useful to have seen at least a couple of the lines output by "ls -lda /home/pi/Temp/*" so I could have seen the permissions and ownership on the files. No need for it now.

I'm really not sure what to suggest re your copy from the share problem. I don't use the file manager and don't have windows 10 pro. Try a copy in a terminal and see what that does. Other than that it could a problem on the windows 10 end, the gui, the network, or something else.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

bctf1
Posts: 25
Joined: Wed Nov 21, 2018 7:00 pm

Re: cifs automount permission error

Tue Dec 11, 2018 1:39 am

thagrol wrote:
Mon Dec 10, 2018 11:01 pm
I'm really not sure what to suggest re your copy from the share problem. I don't use the file manager and don't have windows 10 pro. Try a copy in a terminal and see what that does. Other than that it could a problem on the windows 10 end, the gui, the network, or something else.
Your effort spent and your stamina in trying to figure this out has been very impressive and very much appreciated. Going forward I will simply be satisfied to enter my windows password when connecting to my smb bookmark in the file manager location bar to access this share. It works perfectly even though it is not as sexy as a fstab automount or running a script to mount the share. You are a real asset to this forum.

Return to “Troubleshooting”