Linux Fundamentals — Part 3 [TryHackMe]

gr33nm0nk2802
5 min readJun 11, 2021

This is the final room in the Linux Fundamentals series for beginners. This room is aimed at teaching the students the various utilities used in day to day life. You’re also going to advance your Linux-fu skills by learning about automation, package management, and service/application logging.

Difficulty: Easy

Link: https://tryhackme.com/room/linuxfundamentalspart3

Task #1 : Introduction

Task #2 : Deploy the Linux machine

Deploy the VM and use the credentials provided to connect to the VM.

Task #3 : Terminal Text Editors

In this section we discuss two commonly available command line text editors on Linux. Nano and Vim.

To create a file simply run nano / vim followed by filename

nano myfile

vim myfile

Navigation is fairly simple in nano however vim is slightly complicated and fortunately we have a dedicated room for the vim editor.

In nano to Write to a file CTRL+O and to Exit CTRL+X

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

Task #4 : General/Useful Utilities

While on the terminal we are in certain need to download files. We can achieve this process easily using wget

wget [url]

scp is another interesting utility which will help us to share files using ssh

To send file to a remote device

scp [local_file] remote_user@remote_ip:[path-on-remote-host]

To receive files from a remote device

scp remote_user@remote_ip:[path-to-file] [path-on-local-device]

Also sometimes we are in a need of creating a server to host files for us to be able to download easily. We can use the built in feature of python3 to create a simple http server.

python3 -m http.server

This starts a server in the current directory on port 8000 of the device.

Task #5 : Process 101

ps

kill [pid]

top

ps aux

systemctl [option] [service]

Also processes run in two modes background and foreground mode. To background a process use & or CTRL+Z. This will background the current process. In order to foreground the process simply use the fg command.

fg

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

Next process PID is incremental of the previous pid

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

SIGTERM

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

Q. What command would we use to stop the service “myservice”?

systemctl stop myservice

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

systemctl enable myservice

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

fg

Task #6 : Maintaining your System: Automation

In this section we’re going to be talking about the cron process, but more specifically, how we can interact with it via the use of crontabs . Crontab is one of the processes that is started during boot, which is responsible for facilitating and managing cron jobs. A crontab is simply a special file with formatting that is recognized by the cron process to execute each line step-by-step. Crontabs require 6 specific values:

Cron Guru , Crontab Generator

Q. When will the crontab on the deployed instance (10.10.239.56) run?

Task #7 : Maintaining your System: Package Management

Task #8 : Maintaining your System: Logs

Located in the /var/log directory, these files and folders contain logging information for applications and services running on your system. The Operating System (OS) has become pretty good at automatically managing these logs in a process that is known as “rotating”.

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

Q. What file did they access?

Task #9: Conclusion

Now, we have some fundamental understanding of Linux command and how to navigate around. The next step from here would be to learn bash scripting, vim and find commands.

Some suggested rooms in the lab:

Peace Out

--

--

gr33nm0nk2802

A cybersecurity enthusiast interested in Reverse Engineering. Love to Code