THM Linux Shells

Introduction

This walkthrough covers the THM Linux Shells. It is designed for beginners and focuses on different types of linux shells.

Task 1: Introduction to Linux Shells

We start off reading about Linux shells

The first question ask " Who is the facilitator between the user and the OS?"

Shell

Task 2: How To Interact With a Shell?

This is where you get to interact with a shell, we ssh into the machine with the given credentials.

I would suggest playing around in the terminal to get pretty comforable with it

What is the default shell in most Linux distributions?

Bash

Which command utility is used to list down the contents of a directory?

ls

Which command utility can help you search for anything in a file?

grep

Task 3: Types of Linux Shells

This is where all the good information is. You learn about all the different shells. from Bourne again shell to z shell. Do you know what Kali uses?

Which shell comes with syntax highlighting as an out-of-the-box feature?

Fish

Which shell does not have auto spell correction?

Bash

Which command displays all the previously executed commands of the current session?

history

Task 4: Shell Scripting and Components

Alright this one messed me up with the questions. Granted I spent about 6 hours already going through the Cyber 101 challenge

Description of image

Scripting is super important, It will give you a way to automate things. I usually just use python but bash is a good way to automate process. An example is to linke maybe a nmap scan and a dir search at the same time instead of typing to commands. theres endless possibilities

What is the shebang used in a Bash script?

#!/bin/bash

Which command gives executable permissions to a script?

chmod +x

This one got me all confused. I literally was typing while, loop, etc. once you see the answer you will understand

Which scripting functionality helps us configure iterative tasks?

loops

Task 5: The Locker Script

Alright this challenge is a good one to read the code. We take a look at it and notice that it wants you to put John Tryhackme and 7385 when prompted

Description of image

What would be the correct PIN to authenticate in the locker script?

7385

Task 6: Practical Exercise

lets get our hands dirty with this one

Description of image

I first ls then I flag_hunt.sh to see what is inside the file. Lets open up the file and fix the code

the description says we need to defie the directory and flag. Flag: thm-flag01-script Directory: /var/log

Description of image

well first it doesnt work make you wonder why lets take a closer look. Ah we needed to add the variable $directory I aslso added a few more tweaks

Description of image

Look at that me go the file its in

Which file has the keyword?

authentication.log

Where is the cat sleeping?

under the table

Task 7: Conclusion

I hope you enjoyed learning about Linux Shells like I did.