Saturday, August 3, 2013

SAFE YOUR FILES AND DIRECTORIES


We all know the command chmod and how its works,basically chmod command used to change the file mode bits that is file access permission and we have three general option to do that, that are r(read),w(write) and x(execute). By using plus(+) and minus(-) operator we can add or remove permissions.

For example, you can type on terminal”chmod +x filename”

This will make the file executable, and we can also used other combination to do so. But main problem is that we don't know what kind of permission are file have already, to do so type “ls -g” on terminal and it will show you all file permission in current directory. If it is directory then its show 'd' at the beginning. For more details you can try man chmod on terminal.
Fig : 01

As you know Directory is also a kind of file in Linux file system. So you can also give this kind of permission to your folders as well. That will help you to protect you data from others when you left your PC without Lock it. You can also make home directory lock if you needed. If you want that no one can delete or open or even copy you directory then you can do that also by using following command.

Chmod 000 filename/Directory-name or path

In below image you can see how you can make you directory safe.
Fig : Before Locking Directory
 
Fig : After Locking Directory

No comments:

Post a Comment