Search code examples
ubunturootchmod

How do I change read write permission in /var folder


I installed Apache in Ubuntu and it made folder /var/www.

Inside this folder I intend to create a php file, so that I can check if it is working or not, but I dont have permission to make new documents in there.

I tried chmod 777 /var/www but it says chmod: changing permissions of ‘/var/www’: Operation not permitted

How do I do this? Shall I be root and then do it? How to go about that. I don't know If I ever set my root password during installation of Ubuntu or not, because I dont really remember it right now.


Solution

  • sudo

    sudo chmod 777 /your location

    When it prompts you for your password, type in the password of the account you logged in as.

    do a "man sudo" for more info, but basically it elevates your permissions to root (if you use no other arguments).