2

I'm having a problem with file permissions... Iv'e got a python program to automatically take pictures using fswebcam (by running a bash script using subprocess.call). however when i try to delete these files from my mac (SSH) (or even from the pi command line rm -r without sudo) i dont have permission.

if i run the fswebcam command myself i can delete it.

when created with the script it is owned by root (in group pi) and owned by pi if i run it (and in group pi). Even when i chmod the file to 777 i cannot delete it.

Any solutions?

EDIT: The permissions for the containing folder is drwxr-sr-x. This folder is created using os.mkdir("folder_name"), how do i stop this from creating the folder as both setuid bit and execute bit?

Chetan Bhargava
1,2523 gold badges15 silver badges29 bronze badges
asked Feb 24, 2014 at 17:30
3
  • Check the ownership and permissions of the directory. Deleting a file requires permission to modify the directory. Commented Feb 24, 2014 at 19:07
  • The directories permissions are: drwxr-sr-x. I dont know what the 's' is :/ These created using os.mkdir("folder_name"). Commented Feb 24, 2014 at 20:17
  • Do you have any dmask bits or umask bits set in your fstab file? How is your drive(s) mounted? Commented Feb 25, 2014 at 0:45

1 Answer 1

2

Most likely the files are owned by the user running the python script. My guess is that you are probably running that as root?

when doing an ls -l you will see the permission bits, owner and group.

ie:

ls -l

returns:

-rwxr--r-- 1 root wheel 278 Nov 20 13:22 derp.sh

this means that the file 'derp.sh' is owned by the user "root". "wheel" is the group in this case.

-rwxr--r-- can be split up in 3 parts: owner - group - other like so:

  • | rwx | r-- | r-- We can ignore the first "-" here.

(Other means anyone that doesn't match the owner or isnt in the group)

R means READ

W means WRITE

X means EXECUTE

so in this example:

Root is the owner of the file and can read write and execute this file.

Anyone in the wheel group can read this file.

All other users can also read this file.

answered Feb 18, 2016 at 15:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.