I have Ubuntu Server running and I am setting up a separate directory as a cgi-bin. I have the directory ready and I changed the file for the site. However, to get it to work, I need to change the permissions of the Python script I have in the folder so that Apache can execute it. However, I don’t want to give write or execute access to ANYONE other than root, me and Apache. I’m assuming this is possible, but how can it be done?
chown the files to whatever your Apache group is called (Usually www-data) and set permissions to only give user/group permissions:
chown -R www-data:www-data /path/to/cgi-bin chmod -R 764 /path/to/cgi-bin
That sets it so only the www-data user and group can write the file, and only the www-data user can execute the file, everyone can read.
- Apache doesn’t honor my file’s permissions?
- How to give PHP permissions to write to files without globally opening up permissions to the directory
- Copy a file’s owner permissions to group permissions
- Setting umask for www-data user (run via sudo) on Ubuntu 10.04 LTS
- phusion passenger, apache2 only works with www