0% found this document useful (0 votes)
538 views

LinuxFundamentals JustusKoech

LinuxFundamentals

Uploaded by

kjustus901
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
538 views

LinuxFundamentals JustusKoech

LinuxFundamentals

Uploaded by

kjustus901
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Name: Justus Koech_sc-sa07-24044

Linux Fundamentals Assignment

Overview on Linux Fundamentals

In today's digital landscape, proficiency in Linux fundamentals is indispensable for any


individual pursuing a career in cybersecurity, system administration, or software development.
As exemplified in platforms like Hack The Box, mastering Linux not only unlocks access to a
plethora of tools and techniques but also cultivates essential problem-solving and critical
thinking skills.

Key Lessons to Be Learned:


Proficiency in Linux fundamentals is essential for individuals pursuing careers in cybersecurity,
system administration, or software development, as showcased in platforms like Hack The Box.
Mastering Linux involves learning crucial skills such as command line proficiency,
understanding the file system hierarchy, managing permissions and ownership, process
management, networking basics, package management, scripting and automation, and security
best practices. These skills empower users to navigate the operating system efficiently, optimize
system performance, troubleshoot issues effectively, configure networks, automate tasks, and
enhance system security. Overall, mastering Linux fundamentals is not just about acquiring
technical skills; it's about fostering a mindset of curiosity, problem-solving, and continuous
learning, offering boundless opportunities for growth and innovation in the dynamic field of
technology.
Introduction
The inception of the Linux kernel and subsequent Linux operating system stemmed from
a series of events starting with the release of the Unix operating system by Ken
Thompson and Dennis Ritchie in 1970. Despite early setbacks such as the limitations
imposed by a lawsuit on the Berkeley Software Distribution (BSD), Richard Stallman
initiated the GNU project in 1983 to create a free Unix-like OS. However, it was not until
Linus Torvalds began his personal project to develop a new, free operating system kernel
in 1991 that Linux gained momentum. Since then, the Linux kernel has evolved
significantly, boasting over 23 million lines of source code and licensing under the GNU
General Public License v2.

Today, Linux is available in over 600 distributions, including well-known ones like
Ubuntu, Debian, and Fedora. Praised for its security, stability, and performance, Linux is
utilized across a broad spectrum of devices, from servers and desktops to embedded
systems like routers and video game consoles. Despite its strengths, Linux may present
challenges for beginners and lacks the extensive hardware driver support of Windows.

Being free and open-source, Linux allows for modification and distribution by anyone,
making it highly versatile and widely adopted. Notably, the Android operating system,
which powers smartphones and tablets, is based on the Linux kernel, contributing to
Linux's status as the most widely installed operating system. Moreover, with platforms
like Parrot OS, a Debian-based Linux distribution focused on security and privacy, Linux
continues to play a significant role in various domains, including cybersecurity and
development.

System Information

We need to learn the structure and the information about the system, its processes, network
configurations, users, directories, user settings, and the corresponding parameters. Here is a list
of the necessary tools that will help us get the above information. Most of them are installed by
default.

Questions

Find out the machine hardware name and submit it as the answer.

clAnswer: x86_64

What is the path to htb-student’s home directory?

Answer: /home/htb-student

What is the path to the htb-student’s mail?e

Answer: /var/mail/htb-student
Which shell is specified for the htb-student user?

user?

Answer: /bin/bash

Which kernel version is installed on the system? (Format: 1.22.3)

Answer: 4.15.0
What is the name of the network interface that MTU is set to 1500? Answer: ens192
Navigation

Navigation is essential, like working with the mouse as a standard Windows user. With it, we
move across the system and work in directories and with files, we need and want. Therefore, we
use different commands and tools to print out information about a directory or a file and can use
advanced options to optimize the output to our needs.

Questions

What is the name of the hidden “history” file in the htb-user’s home directory?

Answer: .bash_history
What is the index number of the “sudoers” file in the “/etc” directory?

Answer: 147627

Working WIth Files and Directories

The terminal in Linux is a more efficient and faster tool because you can access the files directly
with a few commands and edit and modify them selectively with regular expressions (regex).
You can also run several commands simultaneously and redirect the output to a file.

Questions

What is the name of the last modified file in the “/var/backups” directory?
Answer: apt.extended_states.0

What is the inode number of the “shadow.bak” file in the “/var/backups” directory?

Answer: 265293
Find Files and Directories

It is crucial to be able to find the files and folders we need. Once we have gained access to a
Linux based system, it will be essential to find configuration files, scripts created by users or the
administrator, and other files and folders. One of the common tools is which. This tool returns
the path to the file or link that should be executed. This allows us to determine if specific
programs, like cURL, netcat, wget, python, gcc, are available on the operating system. Let us use
it to search for Python in our interactive instance.

Questions

What is the name of the config file that has been created after 2020–03–03 and is smaller than
28k but larger than 25k?

Answer: 00-mesa-defaults.conf

How many files exist on the system that have the “.bak” extension?
Answer: 4

Submit the full path of the “xxd” binary.

Answer: /usr/bin/xxd

File Descriptors and Redirections

A file descriptor (FD) in Unix/Linux operating systems is an indicator of connection maintained


by the kernel to perform Input/Output (I/O) operations. In Windows-based operating systems, it
is called filehandle. It is the connection (generally to a file) from the Operating system to
perform I/O operations (Input/Output of Bytes). By default, the first three file descriptors in
Linux are:
1. Data Stream for Input
○ STDIN – 0
2. Data Stream for Output
○ STDOUT – 1
3. Data Stream for Output that relates to an error occurring.
○ STDERR – 2

Questions

How many files exist on the system that have the “.log” file extension?
Answer: 32

How many total packages are installed on the target system?

Answer: 737
Filter Contents
To read files, we do not necessarily have to use an editor for that. There are two tools called more
and less, which are very identical. These are fundamental pagers that allow us to scroll through
the file in an interactive view. After we read the content using cat and redirected it to more, the
already mentioned pager opens, and we will automatically start at the beginning of the file.If we
now take a look at the tool less, we will notice on the man page that it contains many more
features than more.

Questions

How many services are listening on the target system on all interfaces? (Not on localhost and
IPv4 only)

Answer: 7

Determine what user the ProFTPd server is running under. Submit the username as the answer.

Answer: proftpd
Use cURL from your Pwnbox (not the target machine) to obtain the source code of the
“https://www.inlanefreight.com" website and filter all unique paths of that domain. Submit the
number of these paths as the answer.

Answer: 34

User Management
User management is an essential part of Linux administration. Sometimes we need to create new users or
add other users to specific groups. Another possibility is to execute commands as a different user. After
all, it is not too rare that users of only one specific group have the permissions to view or edit specific
files or directories.

Questions

Which option needs to be set to create a home directory for a new user using “useradd”
command?
Answer: -m

Which option needs to be set to lock a user account using the “usermod” command?

Answer: --lock

Which option needs to be set to execute a command as a different user using the “su” command?
(long version of the option)

Answer: --command
Service and Process Management

Most Linux distributions have now switched to systemd. This daemon is an Init process started
first and thus has the process ID (PID) 1. This daemon monitors and takes care of the orderly
starting and stopping of other services. All processes have an assigned PID that can be viewed
under /proc/ with the corresponding number. Such a process can have a parent process ID
(PPID), and if so, it is known as the child process.

Besides systemctl we can also use update-rc.d to manage SysV init script links. Let us have a
look at some examples. We will use the OpenSSH server in these examples.

Questions

Use the “systemctl” command to list all units of services and submit the unit name with the
description “Load AppArmor profiles managed internally by snapd” as the answer.

Answer: snapd.apparmor.service
Task Scheduling

Task scheduling is a feature in Linux systems that allows users to schedule and automate tasks. It
allows administrators and users to run tasks at a specific time or within specific frequencies
without having to start them manually. It can be used in Linux systems such as Ubuntu, Redhat
Linux, and Solaris to manage a variety of tasks.

Questions

What is the type of the service of the “syslog.service”?

Answer: notify
Working with Web Services

There are many different ways to set up web servers on Linux operating systems. One of the
most used and widespread web servers, besides IIS and Nginx, is Apache. For an Apache web
server, we can use appropriate modules, which can encrypt the communication between browser
and web server (mod_ssl), use as a proxy server (mod_proxy), or perform complex
manipulations of HTTP header data (mod_headers) and URLs (mod_rewrite).

Questions

Find a way to start a simple HTTP server inside Pwnbox or your local VM using “npm”. Submit
the command that starts the web server on port 8080 (use the short argument to specify the port
number). ON your linux terminal, enter the following syntax to update or install npm package

Sudo apt install npm

and

npm install -g http-server

Answer: http-server -p 8080

Find a way to start a simple HTTP server inside Pwnbox or your local VM using “php”. Submit
the command that starts the web server on the localhost (127.0.0.1) on port 8080.

This command starts the PHP built-in web server on localhost (127.0.0.1) on port 8080. Any
files in the current directory will be served by the server.

Answer: php -S 127.0.0.1:8080

File System Management

File system management on Linux is a complex process that involves organizing and
maintaining the data stored on a disk or other storage device. Linux is a powerful operating
system that supports a wide range of file systems, including ext2, ext3, ext4, XFS, Btrfs, NTFS,
and more.Regular files are the most common type of file, and they are stored in the root directory
of the file system. Directories are used to store collections of files.
Questions

How many disks exist in our Pwnbox? (Format: 0)

Answer: 3

Conclusion

In conclusion, delving into the fundamentals of Linux, as emphasized in platforms


like Hack The Box Academy, unveils a journey rich with essential skills and insights
crucial for navigating the dynamic landscape of technology. From mastering
command-line proficiency to understanding file system hierarchy, permissions, and
process management, the Linux ecosystem offers a robust foundation for aspiring
cybersecurity professionals, system administrators, and software developers.
Furthermore, Linux's versatility, security, and performance make it a preferred
choice for various applications, from servers to embedded systems. Embracing
Linux fundamentals not only fosters technical expertise but also cultivates a mindset
of continuous learning and problem-solving, essential traits for success in today's
rapidly evolving technological landscape.
Sharable link: https://academy.hackthebox.com/achievement/327320/18

You might also like