In this post, You will learn about the Linux File system and how it is helpful for privilege escalation and below is a video format of the post do check it out ????????
Linux File system
The Linux filesystem structure is somewhat different from that of Windows. Linux doesn’t have a physical drive (such as the C: drive) at the base of the filesystem but uses a logical filesystem instead.
At the very top of the file- system structure is / (root of the directories), which is often referred to as the root of the filesystem.
Keep in mind that this is different from the root user. These terms may seem confusing at first, but they will become easier to differentiate once you get used to Linux.
Most Important directory for Linux privilege escalation
- /root The home directory of the all-powerful root user
/etc Generally contains the Linux configuration files—files that control when and how programs start up
- /home The user’s home directory
- /mnt Where other filesystems are attached or mounted to the filesystem
- /media Where CDs and USB devices are usually attached or mounted to the filesystem
- /bin Where application binaries (the equivalent of executables in Microsoft Windows) reside
- /lib Where you’ll find libraries (shared programs that are similar to Windows DLLs)
he /root directory is the super user of linux computer and you can do anything with root access.
Remember while doing simple tasks go as a normal user, If you are in root user and get hacked then the hacker will get the root access directly.
Under root directory (/) we could see the below directories available.
- /bin – binary or executable programs.
- /etc – system configuration files.
- /home – home directory. It is the default current directory.
- /opt – optional or third-party software.
- /tmp – temporary space, typically cleared on reboot.
- /usr – User related programs.
- /var – log files.
Mostly contains the Linux configuration files that control when and how programs start up.
Also in /etc directory we could find two most important files that is passed and shadow files, Which helps to crack the user and root user password.
The /home directory contains the users directory and files. So, If we are user of kali and download any file and the file will be saved in /home/kali/<downloaded file>.
The /mnt directory and its subdirectories are intended for use as the temporary mount points for mounting storage devices, such as CDROMs, floppy disks and USB (universal serial bus) key drives.
/mnt is a standard subdirectory of the root directory on Linux.
The /media directory contains subdirectories where removable media devices inserted into the computer are mounted.
When you insert a CD or USB into your Linux system, a directory will automatically be created inside the /media directory. You can access the contents of the CD inside this directory.
It’s usually describes as for optional add-on software packages source, or anything that isn’t part of the base system. Only some distributions use it, others simply use /usr/local.
We use the /opt directory only if we install add-ons for a particular software. For eg: If you download an add-on for burpsuite that will be in the /opt directory.
/bin is a standard subdirectory of the root directory in Unix-like operating systems that contains the executable (i.e., ready to run) programs that must be available in order to attain minimal functionality for the purposes of booting (i.e., starting) and repairing a system.
The lib folder is a library files directory which contains all helpful library files used by the system. In simple terms, these are helpful files which are used by an application or a command or a process for their proper execution.
Therefore the commands in /bin or /sbin dynamic library files are located just in this directory. The kernel modules are also located here.
I hope that this post helped you and there are much more directories in linux system but we have seen the impotent ones for privilege escalation.