Change folders/files owner and permissions

In this post we will discuss how to change folders/files owner and permissions.

Change owner

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 .

Here,
your-prefered-folder = directory of the folder which files and sub-folders you want to change owner
username = your user name

Change permission

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).


Source:

  1. http://askubuntu.com/questions/6723/change-folder-permissions-and-ownership
  2. http://www.computerhope.com/unix/uchmod.htm
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.