Changing permissions for /var/www/html

In this case I would leave the directory ownership alone. To modify the permissions for that specific directory so that you can write to it, set read/write permissions, the command being sudo chmod 766 -R /var/www/html. This will assign full permissions 7 for the owner, read/write 6 for the group, and read/write for everyone 6, recursively.


You can make yourself the owner of that directory

sudo chown pi /var/www/html

But you definitely want to set the permissions

chmod 755 -R /var/www/html

Using the -R (recursive) option will make sure that your script files and your .htaccess file are all set the same.


Whenever you add a new script, be sure to set it this way also.

chmod 755 /var/www/html/cgi-bin/newscript.cgi

Note that some CGI programs have their own requirements, such as the

Bestdam Website Visitor Logger + Hit Counter

Excerpt:

Open the bdlogger.pl file in a text editor and if necessary, modify the shebang line.

On the server, create a bdlogger subdirectory under your cgi-bin directory and FTP the script and data files into it using ASCII mode

If you using a UNIX/Linux server, chmod the files:

bdlogger.pl to 755
all other files to 666

Add the following SSI directive tag to your Web page(s):

<!--#exec cgi="/cgi-bin/bdlogger/bdlogger.pl" -->

You need to set the www folder owner from 'root' to 'Me'.

From your terminal, run the command :

sudo chown -R your_system_username /var/www

Hope it Works!!