Giving two different users permissions to a dir

Posted by Jason Swett on Server Fault See other posts from Server Fault or by Jason Swett
Published on 2010-12-21T16:07:18Z Indexed on 2010/12/21 16:56 UTC
Read the original article Hit count: 535

Filed under:

I have a script that is run sometimes via the web, sometimes via the command line. When the script is run via web, it's run via user www-data. When it's run via command line, it's run via user jason.

This script writes to a directory called cache.

  • If I chown -R jason cache, I can run the script as jason but not www-data. This makes sense.
  • If I chown -R www-data cache, I can run the script as www-data but not jason. This also makes sense.

I tried creating a group called scripts, adding my two users, then chowning cache to scripts. I'm not really sure how to do the last part, the chowning part. The Linux command docs I've found online for this are astoundingly bad.

I don't know if I explained this all that well but hopefully it's clear what I'm trying to do. Any advice would be appreciated.

© Server Fault or respective owner

Related posts about linux