I have a Python script that moves files from a folder on my pi to a mounted network drive folder, linked to a Box account.

The script seems to intermittently stop moving the files, and on further inspection, I've noticed the directory permissions being changed from 0777 to 0755, so no wonder only user PI can write files if it's 0755.

1) The script is being called buy user motion, so does it have motions permissions when moving files between directories?

2) Can this directory's permissions change by them self, if so how?

3) would adding sudo to the front of the mv command in the script patch this problem?

4) is it a more elegant solution to make user motion the owner of the script and directories?

5) Could accessing this directory from another computer, via the box site, in any way change its permissions?

Your help and advise it always welcome,



2 Answers 2


1) Yes.

2) No. Probably what happens is the connection times out, and it gets remounted with the wrong permission.

3) Yes. Not very elegantly, though, as you point out yourself.

4) Yes, that would be one way to solve it. Who is the current owner?

5) Probably not.

Have a look in your /etc/fstab - there should be an entry for this mount point, and from there you can set the default permissions.

  • 4) the owner of the source & destination directories are both root. I had a look in the fstab file, but don't know how to set the default permissions so user motion can access it. I currently have --- dav.box.com/dav /home/pi/box davfs rw,noexec,noauto,user,async,_netdev,uid=pi,gid=pi 0 ---
    – reggie
    Apr 20, 2014 at 7:15
  • Would this work in the fstab file:--- dav.box.com/dav /home/pi/box davfs rwx,noexec,noauto,user,async,_netdev,uid=motion,gid=motion 0 --- i've chainged the rw to rwx, the uid=pi to uid=motion and the gid-pi to gid=motion?
    – reggie
    Apr 20, 2014 at 7:49
  • This seems reasonable to me, but the most important question is - does it work?
    – Bex
    Apr 20, 2014 at 8:03
  • dav.box.com/dav /home/pi/box davfs rw,noexec,noauto,user,async,_netdev,uid=motion,gid=motion 0 works
    – reggie
    Apr 20, 2014 at 9:16

Thanks Bex for your help :)

I think it's working now by changing the uid and gid to motion in the fstab davfs mount command. I used this page for reference.

I also noticed that the mounted directory had 0777 permissions with user pi, then I modified the fstab file then did a reboot; to test the re mount.

Following the reboot the permissions changed to 0755 with user motion ; this may explain how the permissions could change, as you suspected.

I'm happy, thanks again,

Reggie :)

P.S. I didn't change the rw to rwx after looking at the above link, i didn't think it was valid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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