HTB ACADEMY — Linux Fundamentals

Introduction

1 - Linux structure

( Read only )

2 - Linux Distributions

( Read only )

3 - Introduction to Shell

( Read only )

The Shell

1 - Prompt Description

( Read only )

2 - Getting Help

( Read only )

3 - System Information

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

To find it, we need to know on which machine we are, the uname command is the more appropriate. We use the -m argument to displays only the hardware architecture of the system.

Answer : x86_64

Question : What is the path to htb-student's home directory?

to diplay the path of htb-student's home directory we need to use the pwd command.

Answer : /home/htb-student

Question : What is the path to the htb-student's mail?

answer : /var/mail/htb-student

Question : Which shell is specified for the htb-student user?

Answer : /bin/bash

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

To see the kernel version we can use the uname command with the -a parameter to display system information in one line. We can use also the uname -r command to have only the kernel version.

Answer : 4.15.0

Question : What is the name of the network interface that MTU is set to 1500?

To see the name of network interfaces using, we can use the ip a s command.

Answer : ens192

Workflow

1 - Navigation

Question : What is the name of the hidden "history" file in the htb-user's home directory?

First i needed to go to the htb-user's home directory and then do the ls -la command

Answer : .bash_history

Question : What is the index number of the "sudoers" file in the "/etc" directory?

Answer : 147627

2 - Working with Files and Directories

Question : What is the name of the last modified file in the “/var/backups” directory?

The ls -t command in Linux is used to list files and directories sorted by modification time in descending order, meaning the most recently modified files appear at the top.

Answer : apt.extended_states.0

Question : What is the inode number of the "shadow.bak" file in the "/var/backups" directory?

Answer : 265293

3 - Editing Files

( Play with vimtutor )

4 - Find Files and Directories

Question : 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?

To find it, we using find command.

Answer : 00-mesa-defaults.conf

Question : How many files exist on the system that have the ".bak" extension?

we use another time the find command but we use in output the wl -l command to return the number of files found.

Answer : 4

Question : Submit the full path of the "xxd" binary.

We submit the first one result :

Answer : /usr/bin/xxd

Question : How many files exist on the system that have the ".log" file extension?

Answer : 32

Question : How many total packages are installed on the target system?

Answer : 737

4 - Filter Contents

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

The grep -v command is used to invert the match in a file or command output. In other words, it displays all lines that do not match the specified pattern.

Answer : 7

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

Answer : proftpd

Question : 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

5 - Regular Expressions

( Read only )

System Management

1 - User Management

Question : Which option needs to be set to create a home directory for a new user using "useradd" command?

Answer : -m

Question : Which option needs to be set to lock a user account using the "usermod" command? (long version of the option)

Answer : --lock

Question : 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

2 - Permission Management

( Read only )

3 - Service and Process Management

Question : 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

4 - Task Scheduling

I didn't find the answer

5 - Network Services

( Read only )

6 - Working with Web Services

Question : 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).

Answer : http-server -p 8080

Question : 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.

Answer : php -S 127.0.0.1:8080

7 - Backup and Restore

( Read only )

8 - File System Management

Answer : 3

9 - Containerization

( Read only )

Linux Networking

1 - Network Configuration

( Read only )

2 - Remote Desktop Protocols in Linux

(Read only)

Linux Hardening

1 - Linux Security

( Read only )

2 - Firewall Setup

( Read only )

Linux Distributions vs Solaris

1 - Solaris

( Read only )

Tips & Tricks

1 - shortcuts

( Read only )

Last updated