Directory Permissions and chmod




 In this blog we are going to see you how we can change the permissions of the directories in Linux using chmod and what are the consequences of changing the directory permissions .

Now lets do a $ ls -l , so that we can see detailed information about directories.

For details about the above information you can refer to blog :” File Permissions, Symbolic Permissions and chmod

1.let’s change the permission of the Test directory for the user so that we reduce the write capability of the user , just write chmod and then user – w which means we are subtracting the write permission from the user and then directory name .Command : $chmod u-w directory_name

 Now , just change to the directory so go inside the directory and try to create a newfile using a touch command and when you press enter you will see it says permission denied because we have right permissions fromthe user so he cannot create any new file inside the directory .

To provide write permission back , can write : $chmod u+w directory_name

2.And now I want to subtract the read permission from the user .To do so we can use command : $chmod u-r directory_name

Now we can go inside the directory using $cd directory_name and we can go inside the directory but when we do ls it says permission denied so we cannot read the content of the directory .

To provide read permission back , can write : $chmod u+r directory_name

3.Now this time let’s take the execute permissions from the user for example so I will just do chmod then user minus x for the directory . $chmod u-x directory_name .

 Now ,try to go inside the directory , it says permission denied you cannot execute anything with this directory so let’s do ls with directory and press enter and this also gives us the permission denied .

To provide read permission back , can write : $chmod u+x directory_name

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 .


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*