solo2500
Posts: 123
Joined: Sat Jul 09, 2016 12:38 am

File permissions???

Sat Jul 30, 2016 9:27 pm

Can someone explain the file permissions below?

pi@raspberrypi:/var/lib/motion $ ls -ld
drwxr-xr-x 2 root root 4096 Sep 7 2014 .


I get this error (see below) and I'm guessing I need to change the file permissions for this path.

Jul 30 15:12:57 raspberrypi motion[635]: [1] [ERR] [ALL] put_picture: Can't write picture to file /var/lib/motion/01-20160730151257-02.jpg - check access rights to target directory
Thread is going to finish due to this fatal error:
I'm a total novice, non-programer (...basically a hack.)

jbudd
Posts: 1409
Joined: Mon Dec 16, 2013 10:23 am

Re: File permissions???

Sat Jul 30, 2016 10:25 pm

The permissions for your /var/lib/motion/ directory are:
drwxr-xr-x Read, Write and Execute for the directory owner (root)
drwxr-xr-x Read and Execute for the members of the group "root"
drwxr-xr-x Read and Execute for everyone else.

So you can't write to that folder unless you are root (or use sudo)

You could change the permissions so that anyone can write to the folder

Code: Select all

sudo chmod 777 /var/lib/motion
but I think a better approach would be to make your program store images somewhere else - your home directory maybe?

solo2500
Posts: 123
Joined: Sat Jul 09, 2016 12:38 am

Re: File permissions???

Sat Jul 30, 2016 11:12 pm

jbudd wrote:The permissions for your /var/lib/motion/ directory are:
drwxr-xr-x Read, Write and Execute for the directory owner (root)
drwxr-xr-x Read and Execute for the members of the group "root"
drwxr-xr-x Read and Execute for everyone else.

So you can't write to that folder unless you are root (or use sudo)

You could change the permissions so that anyone can write to the folder

Code: Select all

sudo chmod 777 /var/lib/motion
but I think a better approach would be to make your program store images somewhere else - your home directory maybe?
THANK YOU!!!
Yes... one step at a time.
Can you tell me why I cant see the file using the Pi's GUI file manager when I point it to /var/lib/motion? I can see them pilling up when I list the contents of /var/lib/motion ie. ls -ld
I'm a total novice, non-programer (...basically a hack.)

jbudd
Posts: 1409
Joined: Mon Dec 16, 2013 10:23 am

Re: File permissions???

Sat Jul 30, 2016 11:30 pm

Can you tell me why I cant see the file using the Pi's GUI file manager when I point it to /var/lib/motion? I can see them pilling up when I list the contents of /var/lib/motion ie. ls -ld
No, I can't. In fact I would have expected ls -ld to show only the current directory ( . ) and none of the files or directories contained within it.

To list the files in a directory I use ls
To also show permissions and ownership, etc I use ls -l
To also show hidden files I use ls -al
To sort the list so recently modified files are at the bottom I use ls -lrt

I don't use the GUI so can't commment on the file manager.

solo2500
Posts: 123
Joined: Sat Jul 09, 2016 12:38 am

Re: File permissions???

Sat Jul 30, 2016 11:34 pm

jbudd wrote:
Can you tell me why I cant see the file using the Pi's GUI file manager when I point it to /var/lib/motion? I can see them pilling up when I list the contents of /var/lib/motion ie. ls -ld
No, I can't. In fact I would have expected ls -ld to show only the current directory ( . ) and none of the files or directories contained within it.

To list the files in a directory I use ls
To also show permissions and ownership, etc I use ls -l
To also show hidden files I use ls -al
To sort the list so recently modified files are at the bottom I use ls -lrt

I don't use the GUI so can't comment on the file manager.
Thank you Sir! You have been a tremendous help!
I'm a total novice, non-programer (...basically a hack.)

Return to “Beginners”