In this post we will discuss how to change folders/files owner and permissions.
To change the owner all of the sub-folder(s) and file(s) of a folder use the following commend:
cd your-prefered-folder sudo chown -R username:username .
your-prefered-folder = directory of the folder which files and sub-folders you want to change owner
username = your user name
To change permissions all of the sub-folder(s) and file(s) of a folder use the following commend:
cd your-prefered-folder sudo chmod -R 754 .
Here, the digits 7, 5, and 4 each individually represent the permissions for the user, group, and others, in that order. Each digit is a combination of the numbers 4, 2, 1, and 0:
- 4 stands for “read”,
- 2 stands for “write”,
- 1 stands for “execute”, and
- 0 stands for “no permission.”
So 7 is the combination of permissions 4+2+1 (read, write, and execute), 5 is 4+0+1 (read, no write, and execute), and 4 is 4+0+0 (read, no write, and no execute).