Tech
Infected

Linux, OpenSource, Programming And Hacks

Apr 8, 2017

Set Permissions to add files to /var/www folder in ubuntu linux

Apr 8, 2017

/var/www is the default root folder of your local web server (like apache), you host all your website files here and access it on the browser with url like http://127.0.0.1 or http://localhost

you cannot simply copy paste stuff in this folder using your file browser, It is protected for security reasons, you will get a permission denied error message because by default you don't have write access permission here.


Follow these Steps:

execute these commands to set all permissions for /var/www directory


sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www
replace <username> with your actual username.

Now you can copy, edit and create files in /var/www folder just like any other folder.




No comments:

Post a Comment