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 |
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 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.
![]() |
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 |
$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 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.
![]() |
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💖