If you can’t explain it simply, you don’t understand it well enough.
Today I will try to explain in a few words basic concepts of linux.
Firstly let’s see what are all the subdirectories of the root directory for.
|/bin||Common binaries shared by the system|
|/boot||Start up files and the Kernel|
|/dev||References to Hardware|
|/etc||System configuration files|
|/home||Home directories of the users|
|/misc||For miscellaneous purposes|
|/mnt||Standard mount point|
|/net||Standard mount point remote file systems|
|/opt||Third party software|
|/porc||virtual file system. Information about system resources is stored here.|
|/sbin||Binaries shared between the system and the system administrator|
|/usr||Binaries, Libraries etc for user related programs|
If you have a standard user in Ubuntu all your personal files are stored at
In Kali Linux you are by default the root user therefore all your files are at
root/. Quick note: if you are new to Kali Linux I would recommend you to create a standard user to start with.
adduser johnCreates a new user.
adduser john sudoAdd the user to the sudoers group.
Everything in Linux is a file. You can see all the files in a directory by browsing to the directory and
ls -l. This will give you output looking like this:
-rw-rw---- 1 root disk 22, 2 May 18 10:26 filename
Let us take a closer look on the output.
-rw-rw---- are the filetype and the permissions.
1 is the number of links/references to the file.
root disk is the user and the group that own the file.
22 the size o the file.
2 May 18 10:26 date when the file was last modified.
filename the name of the file.
In this string
-rw-rw---- the first character is the type of the file. These filetypes exist in linux:
|-||Normal File or hard link||Files that contain text or data|
|d||Directory||Data structure that contains other files|
|l||Symbolic link||Reference to other file on the system|
|s||Socket||Files for inter process communication between environments/networks|
|p||Named pipe||Files for inter process communication|
|b||Block device||Allow buffered access to system hardware components|
|c||Character device||Allow unbuffered access to system hardware components|
The next nine characters
rw-rw---- are the file permissions for this file. There are three sets of user
permissions represented by three characters.
The first three
rw- are for the owner, the second for the group and the last set is for all users. These are
all possible permissions and their representation:
|Characters||Integer Value||Binary Representation||Permissions|
|rw-||6||110||Read and write|
|r-x||5||101||Read and execute|
|r- -||4||100||Read only|
|-wx||3||011||Write and Execute|
|- -x||1||001||Execute only|
|- - -||0||000||None|
There is also one special permission called SetUID. The suid bit is a extended file permission.
If this bit is set the permission looks like this
In the most cases you can find this permission on binaries. With this permission set every user can execute the
binary with the permission of the owner. A bad example would be this situation where the suid bit is set on the bash binary:
-rwsr-xr-x 1 root root 1.1M Jun 17 21:15 /bin/bash
This would lead to a situation where every user can execute bash and escalate their privileges to root.
To change the permissions of a file you can use the
chmod permission file
The permissions are represented in their integer values, also called absolute mode of chmod.
chmod 777 file leads to these permissions
chmod 600 file leads to these permissions
If there is the need to change the owner and group of a file the
chown command is there for you.
chown user:group filename
That was it for the beginning, I hope I could help someone with this post.