Leo Foster
Leo Foster

Reputation: 15

how to get permission to access the index.html file that comes with apache on raspberry pi

for a while now I have been attempting to edit the index.html file that is created when you install apache2 / php5 / liapache2 ect. The command I used to install it was: sudo apt-get install apache2 php5 libapache2-mod-php5

But whenever I try to save my edited version of the index.html, file it comes up with access denied. Furthermore if I try to edit it in nano nothing comes up these are the commands I used :

cd /var/www/ sudo nano index.html

Any suggestions? it would mean a lot to me if someone answered this question Thanks

Upvotes: 0

Views: 3610

Answers (2)

Harvey Fletcher
Harvey Fletcher

Reputation: 1172

Change the permissions of the entire folder

sudo chmod 755 -R /var/www/html 

Upvotes: 0

cnrd
cnrd

Reputation: 16

This is what it says in the Apache documentation from raspberrypi.org:

By default the html directory and index.html file are both owned by the root user. Setting up an Apache web server on a Raspberry Pi

What worked for me is that I changed the owner from root to pi for /www/ and /html/ with this commands:

sudo chown pi: .
sudo chown pi: ..

But note that I'm also just using the Apache server for an local installation and I don't care about security at this point. I don't know how secure this solution is.

Upvotes: 0

Related Questions