Linux Fundamentals HTB
Linux Fundamentals HTB
LINUX FUNDAMENTALS
Tier 0
SOURCE OF FINDINGS:
https://academy.hackthebox.com/module/18/
section/94
1.INTRODUCTION OF LINUX
Linux was first developed in 1970s. in 1991, Linux was licensed under GNU. By now Linux has
over 600 distros around the world.
Principles of Linux
Linux has 5 principles:-
1. Everything is a file.
2. Small, single purpose programs.
3. Ability to chain programs together to perform complex tasks.
4. Avoid captive user interface.
5. Configuration data stored in text file.
1.1Components of Linux
Bootloader - A piece of code that runs to guide the booting process to start
the operating system. Parrot Linux uses the GRUB Bootloader.
OS Kernel - The kernel is the main component of an operating system. It
manages the resources for system's I/O devices at the hardware level.
2. Linux Architecture
3. FILE SYSTEM
The Linux file system is a hierarchical structure used to organize and store files on a Linux system. It
follows a tree-like structure with the root directory ("/") at the top, and all other directories and files
branching off from it. Here's a brief overview of the Linux file system hierarchy:
Creating and managing user accounts in Linux involves several steps, including creating a new user,
setting passwords, managing user groups, and assigning permissions. Here's an overview of the process,
along with some considerations for permissions and security:
File Permissions:
Linux uses a permission system to control access to files and directories.
Use the chmod command to change file permissions.
Example: chmod 755 file.txt (sets read, write, and execute permissions for the owner, and read and
execute permissions for group and others)
User Privileges:
Linux uses the sudo (superuser do) command to grant administrative privileges to users.
Add a user to the sudo group to grant them sudo access.
Example: usermod -aG sudo newuser (adds "newuser" to the sudo group)
Security Best Practices:
7. LINUX SECURITY
Using a firewall is an essential part of Linux hardening to control incoming and outgoing network traffic
and protect the system from unauthorized access. Here's how you can harden your Linux system using a
firewall (specifically iptables):
Install iptables:
Most Linux distributions come with iptables pre-installed. If not, you can install it using your package
manager (apt, yum, etc.).
Configure iptables:
Define your firewall rules using the iptables command. For example, to allow SSH traffic (port 22) and
block all other incoming traffic:
bashCopy code
# Allow incoming SSH (port 22) traffic iptables -A INPUT -p tcp --dport 22 -j ACCEPT # Block all other
incoming traffic iptables -A INPUT -j DROP
Similarly, you can define rules for outgoing traffic using the OUTPUT chain.
Save iptables Rules:
Save your iptables rules so they persist across reboots. The exact method depends on your Linux
distribution.
For iptables-persistent on Debian/Ubuntu:
bashCopy code
sudo apt-get install iptables-persistent sudo iptables-save > /etc/iptables/rules.v4
8. CONCLUSION
In conclusion, Linux is a powerful and versatile operating system that has gained popularity due to its
open-source nature, stability, and security features. Throughout this report, we have explored the basics of
Linux, including its history, file system structure, shell commands, and package management.
Package management in Linux simplifies the installation, updating, and removal of software packages,
ensuring system security and stability. We also explored basic shell commands for file and directory
manipulation, essential for day-to-day system administration tasks.
https://academy.hackthebox.com/achievement/badge/d408ec19-e1d6-11ee-b18d-bea50ffe6cb4
Question 2 solution.
the above image showing the inode number of the file “shadow.bak” as 265293
Answer is 00-mesa-defaults.conf