How do I edit permissions of a folder/file as shown?

March 28, 2015 3.1k views
DigitalOcean Security

How do I edit permissions of a folder/file as shown?

  • The below is the permissions I have set for /var/www/html:

    chmod 755 /var/www/html

    What is it you're trying to accomplish?

  • Im doing it because I have an error here :
    It doesn't work the command you gave me.

  • If you find where those directories are located (The ones in the red box on and do a chmod 777 on each one of them, for example (Assuming they are located in /var/www/html:

    chmod 777 /var/www/html/cache

    Or you may be able to do them all at once if you use the recursive option, just find the directory one up from all those listed and do:

    chmod -R 777 /var/www/html
2 Answers

Hi there,

To change file/folder permissions you'll want to use the chmod command:

chmod {options} filename

For example the below will grant the owner of the file (referenced by u) write permissions (referenced by +w) on the file example.txt:

chmod u+w example.txt

You can also use binary references to set file permissions for all users. For example the below will give the owner & group that the file belongs to permissions to read, write and execute (Read = 4, Write = 2, Execute = 1), whilst anyone else will only be able to read the file:

chmod 774 example.txt

The following link fully explains file permissions and the respective commands that can be used to control this:

Hope this helps!

  • It helped a little but If I want to make a folder options:shown and the folder is called html and its in /var/www/html can you tell me what to write exactly please.

Have another answer? Share your knowledge.