Hello guys, back with the next part of Linux basics for hacking. This is seventh part of our series. In the sixth part we learned about the networking commands in Linux. In this this part we will go through linux file permission commands.
Linux File Permission Commands
File permissions are access specifier for a file to restrict someone in the terms of usage of a file. There are some commands that are helpful for a person to use to specify the file access. Here are some Linux file permission commands.
Check a file’s permission
To check the permission of the file first of all go to the directory where it is stored. Now you can use the command called ls with -l switch. This switch is for long list of file.
The output of the command will show us many things line by line. You can see them to know the permission of any file. Also Read : Learn basics of Linux hacking for hacking aspirants Part 6
This will show you the file permissions, number of links, owner of file, the group owner, size of the file, creation modification date, and the name of the file.
if the line starts with -d then it is a directory & if it starts with – then it is a file.
The three permissions on a file is read, write & execute which are represented by r,w,x.
Change permission for a file
If we want to change the permission of a file for a group of users then a command called chmod is used to do this. A file’s permission is changed by root or the owner of the file. Permission can be changed by the binary equivalent of the permission added. r :- 4 w:- 2 x:- 1
If we want to change the permission we have to use these numbers for it. If we want to give all three permission to any group, we have to use 7 for it. If we want to give only permission for read then it will be 4.
Now there is a file name “technology” & we are going to use the command chmod in the file.
chmod 7 7 4 technology
This command will give permissions to owner, group & other users some permission s which are shown as below. owner or user :- rwx (All three permissions) group :- rwx (All three as owner) others :- r (Only Read permission to other group)
Remove a permission
UGO is the letter used in the change of permission. UGO stands for user, group & other.
There are three operators for adding or deleting a permission.
+for add a permission –for subtract a permission =to set a permission
So if I want to remove a write permission from the group than write this command.
chmod g-w Technology
This will remove the write permission from the group users.You can also edit the two permissions of the file in one line like
chmod u+x, g+x technology
This command line will add execute command in user & group for the file technology.
While installing a new hacker tool
There will be a situation when we will download a new hacker tool for installation. After we download, unzip & install it, we start executing the tool. Now what message shown “You have no permission of executing it“. With this command chmod you can add the execute permission to your user. This will let you execute the file form the Linux system. Also Read : Learn basics of Linux hacking for hacking aspirants Part 5
Thank you readers to follow this. If you have understood the article, start your practice to use them. Like our facebook for the next update for this article. Thank You.