Changing file permissions of a folder and all of its subfolders and files in Ubuntu.

Changing file permissions in Ubuntu is a very essential thing. If proper file permissions are not set to folders or files, it is not possible to execute any PHP or HTML files from the browser using localhost. The following command can be used to set file permission for any file or folder.

sudo chmod 755 /var/www/myfolder

In the above example

    7 – Owner(current user)
    5 – Group(set by owner)
    5 – anyone else

To change the file permission for all the files and subfolders inside a folder the following command can be used:

sudo chmod 755 -R /var/www/myfolder 

0 – no permission, this person cannot read, write or execute
1 – execute only
2 – write only
3 – execute and write only (1 + 2)
4 – read only
5 – execute and read only (1 + 4)
6 – write and read only (2 + 4)
7 – execute, write and read (1 + 2 + 3)

Comments

Post a Comment

Popular posts from this blog

Getting latitude, longitude, timezone using ip address.