Write Permissions Needed on entire Path?

Asked by Motion_Noob on 2009-01-27

My Motion.conf file had jpegs and swfs saving to in the /tmp/motion folder, and it gets deleted on reboot.

I changed the target_dir to /home/myname/Videos/motionvids , but no files are created in that directory. I saved the changes made to the motion.conf file, and stopped and restarted motion, but still no files are created in that directory.

So I changed the target_dir back to /tmp/motion, and now jpgs and swfs are created fine.

I tried changing the permissions on the motionvids folder to 'Create and delete files' for the 'Others' user, but I didn't change any permissions on the parent folders (Videos, myname, home.)

First, am I setting the correct permissions for the correct user, and if so, do I need to set them for each folder in the whole path?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu motion Edit question
Assignee:
No assignee Edit question
Last query:
2009-01-28
Last reply:
2009-01-29
Ralf G (r-gollmer) said : #1

Got no knowledge about the motion software, but as you created and own the directory /home/myname/Videos/motionvids you have rwx permissions, unless you set your default permissions in a strange way. And if you run the program, normally the program needs just YOUR permissions. So I guess there must be something else in the configuration of motion inhibiting the writes. What happens if you try to save something from within the program?

If you want to grant someone else write access to a subdirectory of yours, that person (either in the same group - then the group needs that permission, or outside the group, in which case its 'others') has to have the execute permission to the intermediate stages (your home directory included) in order to be able to change to that target dir. But you don't have to grant write permissions for the upper levels to others, not even read (which would allow to display the directory contents) is needed, just write and execute for the target dir. But I don't think this is of any relevance for your problem.

Ralf

Akku (gagersheads) said : #2

i forget my username and password to login what can i do please help?

Motion_Noob (motion-noob) said : #3

So Ralf,

You're saying that, in addition to the 'Create and Delete files' permissions I have set on the target directory, I also need to set 'Execute' permissions on that directory?

If so, there wasn't an option in the GUI to do that. So I need to do it at the command line?

Motion_Noob (motion-noob) said : #4

"And if you run the program, normally the program needs just YOUR permissions"
"What happens if you try to save something from within the program?"

Motion launches automatically when Ubuntu boots. It runs by command line only. There is no GUI. So I don't know how to "save something from within the program" other than by waving my hand in front of the camera, causing motion to capture jpegs and mpegs (when the target_dir parameter is set to /tmp/motion) and save them in the /temp/motion directory.

But no such files are created, as far as I can tell, when the target_dir parameter is set to /home/myname/Videos/motionvids.

Ralf G (r-gollmer) said : #5

Ok, if motion is launched automatically at boot time the user ID of the running program is not you. You could find out the user ID by the command line
top
and finding the process motion or by
ps -efa | grep motion
(if the process name contains motion)

I suppose it is a special user for that program (not root).

To set execute permissions for everyone to a directory issue the command
chmod a+x dirname
from the command line. You could also specify the rights by digits expressing the binary coding of rwx permissions for owner, group and others (the rest of the world).
chmod 777 dirname
would thus grant all rights for that directory to everyone (7=111 binary).
Resume: try to issue the followinf three commands:
chmod a+x /home/myname
chmod a+x /home/myname/Videos
chmod a+rwx /home/myname/Videos/motionvids

You could just try if after doing so another user could write to that directory by
sudo su nobody
touch /home/myname/Videos/motionvids/testfile

if there is no error message you could look into that dir and you'll find by
ls -la /home/myname/Videos/motionvids
something like (the permissions of .. might be different in your case but they should include x for group and others)
drwxrwxrwx 2 myname users 4096 'date time' .
drwxr-xr-x 7 myname users 'size' 'date time' ..
-rw-r--r-- 1 nobody nobody 0 'date time' testfile

If that touch command works, anyone and also any program is capable of writing to that dir, you could remove the testfile by
rm /home/myname/Videos/motionvids/testfile

If there is still no video saved when directing the output of motion you are sure that it must have some cause something else, not the permissions.

Can you help with this problem?

Provide an answer of your own, or ask Motion_Noob for more information if necessary.

To post a message you must log in.