Ok, I thought I understood linux permissions and users and groups and all that, but I'm very confused about something. I've installed lighttpd, and left it's default dir at /var/www with cgi enabled and pointing to /var/www/cgi-bin/.
I dropped some python files in there and it works. I can browse to the directory via ssh and run them, and I can hit them in my browser and they run also.
The weird thing is that I can no longer drop files into the cgi-bin folder via sftp. I assumed it was a permissions error, and when I ran ls -l I get drwxrwxr-x fr the folder. Is that why I can't ftp files? My ftp user is not the owner or group for that folder. But then I checked the .py files themselves and got -rw-r--r--. So how can these scripts execute? It looks like no one can run them, but I can run them directly or via lighttpd in a browser.
What's going on here?
/var/www/*
. Personally I keep all files owned in /var/www/* owned by root:www-data and ro by www-data. There are other options, see the link I gave you. – Panther Feb 19 '13 at 00:18x
permissions. The web server runs as www-data. If your user is in the www-data group, and the files have r-x permission for www-data group you are good to go. See also https://help.ubuntu.com/community/FilePermissions – Panther Feb 19 '13 at 17:44