How to change directory permission on linux using chmod command | Pro Tech guides

How to change directory permission on linux using chmod command

Directory permission on linux, their are three permissions read, write and execute. The permissions can be changed by chmod command.

Directory permission in linux with examples and it's purpose (with pictures)

Directory permission on linux
Directory permission on linux

Hello guys welcome to the next session on Linux command line to tutorial for beginners. In the last session I've shown you how you can change the permissions of the file using "chmod" in Linux.

In this session I am going to show you how we can change the permissions of the directories in Linux using "chmod" and what are the consequences of changing the directory permissions.

So let's get started as you can see here I have a directory called "demo" on my desktop.

Read, write and execute permission in linux
Read, write and execute Permissions

Here you can see the permissions.

Now in the last session I have shown you this first letter shows the type of file or directory.

So because it's a directory it's showing "d". 

Next three values here is the permissions of the "user".

Next three is the permission of the "group". 

And the next three is the permissions of "everyone" else.

Removing write permission

Now let's change the permission of this directory for the user so that I will reduce the write capability of the user.

Directory permission to remove write
Remove write permission

$chmod u-w directoryName
I will just write "chmod u-w demo" and press ENTER.

Now you can see that "user" doesn't have the write permission.

Now you can see there's a lock symbol appears on the directory in GUI Interface.

Because it doesn't have the "write" permission that's why this lock symbol appears.

If I want to create a new file for example, I will just use "touch file3" and when I press ENTER.

You can see it says permission denied because we have taken the "write permissions" from the user.

So user cannot create any new file inside this directory.

Removing read permission

I want to take the "read permission" from the user.

Remove read permission
Remove read permission

$chmod u-r directoryName
So I want to subtract the "read permission" from the user.

So just write "chmod u-r demo" which will subtract the read permission from the user for the directory.

For example I will do cd demo and we can go inside the directory but when I do "ls" here you see it says permission Denied.

So we cannot read the content of the directory because we have taken the read permissions from "user".

Remove execute permission

Now this time I want to take the "execute permissions" from the user.

Remove execution permissions
Remove execution permission

$chmod u+x directoryName
For example I will just do "chmod u-x demo" and press ENTER.

And you can see the "execute permission" from the user is taken.

Now I will try to go inside the directory which is demo and it says permission denied.

So I cannot execute anything with this directory.

Permission on linux
Example

So let's do "ls" with directory and press ENTER and this also gives us the permission denied. So it shows the content of the file but access to this files is not possible.

You cannot even go inside the directory. So  you cannot access the content of the file.

Conclusion

So this is how you can change the permissions of the directory.

And this is how the changing of the permissions of the directory behaves this is the consequences.

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

HAVE A PEACEFUL 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: How to change directory permission on linux using chmod command
How to change directory permission on linux using chmod command
Directory permission on linux, their are three permissions read, write and execute. The permissions can be changed by chmod command.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzrj54GWJpG3D2ZOAPdXCVojWwwkIO6lqyXOwc_urWqM_-xxQ1Etv_tGK4t-9m5YV7Hw784wZFQTIjMlw4PZhA4OS00S4Wrd5usqIWgO2dKQamR52VqSRDvFyahR5YsxYc-WDmb1CeHiw/s16000/dir-permission.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzrj54GWJpG3D2ZOAPdXCVojWwwkIO6lqyXOwc_urWqM_-xxQ1Etv_tGK4t-9m5YV7Hw784wZFQTIjMlw4PZhA4OS00S4Wrd5usqIWgO2dKQamR52VqSRDvFyahR5YsxYc-WDmb1CeHiw/s72-c/dir-permission.jpg
Pro Tech guides
https://devops-digest.blogspot.com/2020/12/how-to-change-directory-permission-on-linux-using-chmod-command.html
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/2020/12/how-to-change-directory-permission-on-linux-using-chmod-command.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