after trying to modify permissions I can no longer access localhost

I was getting sick of having to sudo every command in my web development folder (/var/www) so I tried to change the permissions to 777. The function seemingly worked (that is, gave no error), although I still wasn’t able to edit any of the documents without root access.

Anyway, this isn’t really a problem, I just thought I’d give it a shot. The trouble is, now, when I direct my browser to localhost, I get a 403. I presume it has to do with my modifying permissions, although, having changed it to 777, I can’t see what permissions it could be lacking. Have I perhaps changed the owner or something similar?

Thanks in advance for any help.

Answer

Depending on which distribution of Linux/Unix/BSD you use, your web server may feel that 777 is too insecure for the open web and refuse to serve pages because the permissions are set too liberally. If your /var/www/ folder is writable to anyone someone could just hijack your server, and your apache (or whatever web server you use) ist trying to protect you from that.

Try resetting permissions to the minimum that is needed to operate. You may want to su to the user you need to be (su - www for example) so you don’t need to sudo everything, or you can sudo yourself a whole shell as Sirex suggests.

If your web server is running as root now you may also want to give it a user of its own. If it doesn’t need to be root, don’t let it be root — for security’s sake.

Attribution
Source : Link , Question Author : wyatt , Answer Author : Olfan

Leave a Comment