Skip to content

Linux Fundamentals Part 3 Banner

Linux Fundamentals Part 3 Logo

Linux Fundamentals Part 3

This guide contains the answer and steps necessary to get to them for the Linux Fundamentals Part 3 room.

Table of contents

Terminal Text Editors

Create a file using Nano.

To create a file with nano we use the following command:

nano textfile.txt

Create Nano File

Another method of creating and editing files is vim. More info can be found here.

  1. Edit "task3" located in "tryhackme"'s home directory using Nano. What is the flag?

We can log into the system using ssh and the provided credentials using:

ssh tryhackme@10.10.181.62

Next we can edit the required file using:

nano task3

Edit File

Here we find our flag.

Click for answerTHM{TEXT_EDITORS}

General/Useful Utilities

Ensure you are connected to the deployed instance (MACHINE_IP)

Now, use Python 3's "HTTPServer" module to start a web server in the home directory of the "tryhackme" user on the deployed instance.

To start the http server on the target machine we use the following command:

python3 -m http.server

Download the file http://MACHINE_IP:8000/.flag.txt onto the TryHackMe AttackBox

  1. What are the contents?

To download the file we use the following command after setting up the http server:

wget http://10.10.181.62:8000/.flag.txt
cat .flag.txt

Transfer File

Click for answerTHM{WGET_WEBSERVER}

Create and download files to further apply your learning -- see how you can read the documentation on Python3's "HTTPServer" module.

Use Ctrl + C to stop the Python3 HTTPServer module once you are finished.

Processes 101

  1. If we were to launch a process where the previous ID was "300", what would the ID of this new process be?

The next process would have their pid incremented by 1.

Click for answer301

  1. If we wanted to cleanly kill a process, what signal would we send it?

This is one of the signals we can send with the kill command.

Click for answerSIGTERM

  1. Locate the process that is running on the deployed instance (MACHINE_IP). What flag is given?

To locate this process we use the ps aux command to list all running processes.

Flag Process

Click for answerTHM{PROCESSES}

  1. What command would we use to stop the service "myservice"?

This is done with the systemctl command.

Click for answersystemctl stop myservice

  1. What command would we use to start the same service on the boot-up of the system?

This is also done with the systemctl command.

Click for answersystemctl enable myservice

  1. What command would we use to bring a previously backgrounded process back to the foreground?

This can be done with the fg command.

Click for answerfg

Maintaining Your System: Automation

Ensure you are connected to the deployed instance and look at the running crontabs.

  1. When will the crontab on the deployed instance (MACHINE_IP) run?

To view the existing cronjobs on the machine we can use:

crontab -e

Crontabs

Click for answer@reboot

Maintaining Your System: Logs

Look for the apache2 logs on the deployable Linux machine

  1. What is the IP address of the user who visited the site?

We can find the logs in /var/log/apache2 folder.

Looks like we don't have access to the log file. However, it looks like there is a backup of this file present in the same folder which we can view.

Logs

Click for answer10.9.232.111

  1. What file did they access?

In this same log file, we can see which file they accessed.

Click for answercatsanddogs.jpg