file permissions in linux using chmod command | Pro Tech guides

file permissions in linux using chmod command

File permissions in linux is done by chmod command. It allows you to give permissions in a file, directory, etc.. Three main permission r, w, x

chmod command in linux | linux permissions | with pictures and examples

chmod command in linux
chmod command in linux

Hello, guys welcome to the next session on Linux command line tutorial. In this session, we will see how we can use File permissions in Linux.

And especially I'm going to talk about symbolic permissions.

So let's get started,

First of all, I'm going to change the directory to the desktop.
linux file permission command
Desktop

And you can see here I have a file which has a name "file" itself.

So what I want to do is I want to list the long listing of this file. so I will just do "ls -l" and press ENTER.

file permission in linux
file permissions

This thing here is the permission for the file.

Now the first minus (-) on the left-hand side you can see. It is the type of file.

If it's minus (-) it means it's a normal file.

If it would be "D" then it will be a directory.

If it would be a character special file then it would be a "C".

If it would be "B" then it would be a binary special file.

Owner / user permissions

permission for owner
permission for owner

The first three-element you can say here is for the owner of the file.

Group permissions

group permissions in linux
permission for group

The next three is for the group of the file.

Others/everyone's permissions

file permissions for everyone
permission for everyone

And the last three is permission for everybody.

Symbolic Links

symbolic links in linux
symbolic links

The next you can see here is "1" and this "1" stands for the symbolic links of the file. So right now I have only one link.


Name of the owner

Name of the owner
owner's name

This name "root", which is the owner of the file.

Name of the group

group name in linux
group name

This is the name of the group.

Main permissions

So let's try to change the permission of the "file". There is a utility called "chmod" which stands for Change Mod to change the permission of the file.

There are 3 main kinds of permission,

  • r - read
  • w - write
  • x - executable


change the permissions for everyone

change permission for everyone
change permission for everyone

$chmod o+yourPermission filename
I want to allow the other persons to execute this file.

So what I can do is I will just use "chmod" which is the utility to change the permission of the file.

"o" stands for others (or), everyone.

plus (+) or is for adding the permission.

minus (-) is for subtracting the permission.

Now I want to grant the executable permission to the other user.

So just say "chmod o+x file" and press ENTER. The permission is changed.

change the permission in the group

change permission for group
Group's permissions

$chmod g+yourPermission fileName
Now I want to change the permission of the "group".

I want to grant executable permission.

So I will use "chmod g+x file" and just press ENTER.

The "g" denotes group.

Reducing permission

Remove permissions in linux
Remove permissions

$chmod g-permissions fileName
Right now group can read, write and execute.

I want to make it just to read.

So I just say "chmod g-wx file" and press ENTER.

As I told you "g" is for the group.

Minus (-) is for reducing permission.

change or overwrite permission multiple users

overwrite permissions using chmod
overwrite permissions

$chmod ug=yourpermission fileName

For example, I want to give permission to the user and group of this file to read, write and execute.

You can use "chmod ug=rwx file" and press ENTER.

Instead of using the plus (+), you can also use equal to (=) for granting the permission.

By using equal to (=) you can overwrite the existing permissions.

Add or Remove all users permissions

add or remove permission in linux
add or remove all permissions

$chmod a-yourPermissions fileName
If you want to remove or change the permission to everybody.

For example, I want to remove the permission for the user, group and the others. So that they cannot even read-write or execute.

You just need to say "chmod a-rwx file" and press ENTER.

"a" stands for All. This means it stands for user, group and others.

conclusion

So this is how you can change the permission of a file using symbolic notation.

This is how you can change the permission.

I hope you've enjoyed this tutorial please rate comment and bye for now.

HAVE A NICE DAY💖

Name

Apps,3,Games,1,Linux,38,Linux Commands,37,Network-Devices,1,Networking,1,Terminal Apps,2,Termux,17,Userland,3,Windows,1,
ltr
item
Pro Tech guides: file permissions in linux using chmod command
file permissions in linux using chmod command
File permissions in linux is done by chmod command. It allows you to give permissions in a file, directory, etc.. Three main permission r, w, x
https://1.bp.blogspot.com/-fisi_DgCCqA/X989ASBiGqI/AAAAAAAACxo/ZhG6vGcunWwCLGehXp6d1W8wIjlPcPlYgCNcBGAsYHQ/s16000/chmod.jpg
https://1.bp.blogspot.com/-fisi_DgCCqA/X989ASBiGqI/AAAAAAAACxo/ZhG6vGcunWwCLGehXp6d1W8wIjlPcPlYgCNcBGAsYHQ/s72-c/chmod.jpg
Pro Tech guides
http://www.protechguidez.com/2020/12/file-permissions-in-linux-using-chmod.html
http://www.protechguidez.com/
http://www.protechguidez.com/
http://www.protechguidez.com/2020/12/file-permissions-in-linux-using-chmod.html
true
7053638852026728047
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content