I’m new to Linux-like operating systems, and I’ve come across an issue where when a program tries to create a file or directory, it doesn’t have the proper permissions. Specifically, PHP running as the user www-data cannot access or create files or directories when the working directory is owned by the root user. I tried changing individual file permissions with chmod but that did not work; I was successful with using chown to allow PHP to create a file in a directory it owned, but now I as a root user cannot access any of the files it creates without moving them to a directory owned by root (even though the PHP-owned directory is still owned by the root group). Is there a way to give multiple users ownership of a directory? Thanks!

  • 1
    Welcome to Unix & Linux at Stack Exchange! In order to make it easier for others to help you with your problem, you should give more specific details, such as directory names, output of ls -la on the directory, which kind of chown/chmod commands you used, the expected result, whether you have mount points, what is the Linux distribution you are using, etc. As it stands now, your question is too vague for someone to be able to give you constructive advice, so please add a bit more! – filbranden May 10 '18 at 3:09
  • @FilipeBrandenburger I’ll add those tomorrow, the specific machine is at my school. It’s a raspberry pi, running a derivative of Debian I believe. Thanks for the quick response though! – Arik Rundquist May 10 '18 at 3:17
  • this problem is usualy solve by a common group owing directory (www-data), and chmod rwxrwxr-x dir. – Archemar May 10 '18 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.