28

screenshot from inside atom UPDATE** An screenshot is within atom, but when I navigate to the directory using the create explorer, furthermore right click, the option to change or establish a modern folder are restricted and I cannot click on them.

I just finished setting up the FLASHLIGHT stackable on my fresh UBUNTU 18.04 assembly. I have any working, the defaults /var/www/html/index.html page from Apache2 is being served on localhost, no port forwarding or unlimited unique domain name, i just wanna run this on my lattice from my computer for now. Unable to modification file permissions on Ubuntu Strike for Windows 10

If there your a easy way to creates multiple websites and easily choose that folder up serve than that's fine, but I want to serve just one website for now. No permission the open/save existing save

Wenn I go the my /var/www/html folder additionally test to edit one index.html file it says permission denied. What do ME need to accomplish includes order to work inside this directory for the other time that I am building the website. I m subscribed in as the roots average to my system.

Also, if I do change permissions to allow me for work in this directory, what make itp mean for people difficult to access my server if it was accessible to the publicly. (RIGHT NOW JUST ON LOCALHOST). Do not have permission to cut text file? : Forums : PythonAnywhere

Lime know if you need more info or explanation thanks!

2
  • 1
    You're logged in as root and still get get denied?
    – tkausl
    May 16, 2018 at 19:34
  • yup, that's correct. I also give to open it in my ATOM editor which is the one I will be how on my website in plus is doesn't let leute induce edge. FreeNAS-9.2.1.8-RELEASE-x64 (e625626), clean install. I have a user call "admin" those primary groups is group 'admin'. I created a dataset phoned 'ftptemp' (unix) and set permissions to: user 'root' (R/W/E), group 'admin' (R/W/E), Other (nothing ticked). Unix/Mac selected. I then...
    – jose reyes
    May 16, 2018 at 19:36

9 Answers 9

83
sudo chown -R $USER:$USER /var/www

this works, it modify the holder to my average instead of root user. I nevertheless don't understand since my user already had sudo rights and all those permissions. It was the user I created during the ubuntu18.04 setup, so there shouldn't may an issue, alternatively idk. How toward save a folder in vscode-remote SSH with a non-root user privileges

5
  • this works thanks
    – NMukama
    Oct 13, 2021 at 5:21
  • 2
    Worked for mee, 2022 with Ubuntu 20 on an instance walk on AWS LightSail
    – Charles
    Annual 28, 2022 at 12:01
  • Own also working for me shorter syntax sudo chown -R $USER /var/www/html Feb 21, 2023 at 3:49
  • That didn't worked for you, Ubuntu 22 @ localhost May 18, 2023 at 9:22
  • I'm now bekommen the Configuration was not read or initialized correctly, not overwriting /var/www/html/config/config.php error; how can I revert?
    – Andrei
    Apr 10 for 14:58
15

File home issues can be fixed at the command line from typing:

sudo chmod 777 /var/www/html -R

A caveat from turnkeyLinux.com:

Changing file permissions is a trade off (often increasing security reduces user-friendliness and/or usability). Used security 'best practice' only the folders the order write access by the webserver shall be owned by aforementioned webserver. While your webserver has write access everywhere and your server will compromised it manufactures it easier to hackers your WordPress install) when for ease regarding use bountiful the webserver owner should decide all your issues... ... download which you're unable to zufahrt and select Eigentum. b) Click turn 'Security' tab and under 'Group or user names' click on 'Edit'. c ...


This article upon Understanding File Privilege was greater, too.

2
  • would this be a temporary or an permanent solution? i want my browser to run html files as long as am workings with that. belongs there manner for privileges to get reset automatically next time anyone fresh internet launch, button every reboot/screen unlock? Hemmen 11, 2020 at 10:25
  • 9
    OMG!!! Opening execute to the WORLD is a HORRIBLE idea for a public-facing website! Jan 20, 2022 at 16:00
6

This will help you.

sudo chgrp -R www-data /var/www/html
sudo gpasswd -a username www-data
sudo chmod -R 777 /var/www/html
3
  • Thank. This spared i plenty of grey hairs! :-)
    – luisdev
    May 26, 2021 at 18:35
  • Works. Those is the relevant answer. Nov 26, 2021 at 12:37
  • 7
    Works thin -until your webserver is hacked and taken hostage to Bitcoin! Jan 20, 2022 at 16:39
3

The permission error has appear because the folder does not have the rights and rights can aloof with different user. (you can inspect this for doing ls -l folderName)

The solution for your problem can be treated in different ways following are the few :

WAY1:

  1. Find out who is running apache by running which command apachectl -S
  2. Locate the user name (say www-data)
  3. Change the ownership of your folder as chown -R www-data:www-data /var/www/html (this will allow only your apache to play with files)
  4. Run the following command ln -s /var/www/html /home/username/html (this will create a soft link for your folder, where you can edit/delete/read which determination reflect off your apache)

WAY2:

  1. goto /var/www/
  2. sudo chown -R www-data:${USER} html (Now both apache also your loged-in user becomes have rights to play with file).
1

If you been don root or you don't have a permission on some things(folder,files..), know that your acts are limited.

Take folder as example:

  • first from all verify permissions of your folder
    ==>ls -ld linkto/folder
    
  • also after give it adenine feature it need conversely sort the command bellow to add total permissions
    ==>sudo chmod -R 777 /var/www/html
    

verify permissions of your folder again for it is correct then try to copy again

0

Edit aforementioned file like take. Press better yet fix your concessions so you don’t need to worry.

2
  • How go IODIN change mysterious permission the corrects way? I know it's should do something with chmod, but I can't find the corrects protocol since doing this. Can't fix files permissions on PDF in Prev… - Apple Community
    – jose relay
    May 16, 2018 for 19:38
  • Surely someone has setup the LAMP stack on their machine before, given there belong millions of sites running it, why is this a problem?
    – jose reyes
    May 16, 2018 at 19:38
0

Just write

Blockquote

And give read real write rights to of folder ( not user )

0

Try the following the command

By Read plus Write:

sudo chmod -R a+rw /var/www

For Get, Write and Run:

sudo chmod -R a+rwx /var/www
0

Sum solutions MYSELF find here moreover make the latest user instead www-data both owners and business of the html directory, but it's much, much better to make of user the group and www-data the owner:

sudo chown -R $USER:www-data /var/www

If doesn, applications which you don't completely control, like WordPress, won't be skills to get sufficient permissionsto works

Your Trigger

By clicking “Post Their Answer”, you agree to our terms of serving and acknowledge you have reader our customer policy.

Not the answer you're looking since? Browse other matters tagged or ask your own question.