Lets change the default directory used for storing web files as the current html directory is also owned by root and its a good practise to not use it - activethought.net ![]()
sudo mkdir /var/www/webroot
Assign this new directory to the apache group
sudo chgrp www-data /var/www/webroot sudo chmod g+s /var/www/webroot
Add our SSH user that we login with to the www-data group
sudo useradd -g www-data ssh-user-name
Now update the apache config to point to this directory
sudo nano /etc/apache2/sites-enabled/000-default.conf
Add umask to /etc/apache2/envvars
sudo nano /etc/apache2/envvars
add “umask 002” to the end of the file. Save and quit.
This allows the Apache www-data user (ie cgi scripts) to read and write to files - serverfault.com ![]()
Now restart Apache using:
sudo service apache2 restart
or:
service apache2 stop; service apache2 start
If everything goes according to plan, you should be done. You should now be able to access files on your web server. You will also be able to login to your LiveCode Server via SFTP and manage your web server files via an application like FileZilla.
# Notes on permissions
What you may want to do is to instead set the groups sticky bit (SetGID) bit on the directory your CGI is working with: chgrp mygroup dir chmod g+s dir Make sure when you do this that (user) apache is in the mygroup group (in /etc/group), so it will have permissions. This will make it so any file created under this directory will be owned by the same group as the directory. This is a safer approach than setting a global umask for EVERY cgi script that apache may run. (This is how git-http-backend is typically run from Apache).