Skip to main content

Linux Fundamentals Part 2 | TryHackMe: Walkthrough | INFOCODX

 


Simplified and beginner-friendly documentation of the Linux Fundamentals Part 2 Room on TryHackMe, featuring a step-by-step guide and answer key.


Room URL: Linux Fundamentals Part 2


Task 1 (Introduction)


Ready to begin? This area will guide you through flags, arguments, advanced filesystem information, and permissions!

Nothing more to do here but proceed to part 2!


Task 2 (Accessing Your Linux Machine Using SSH)


To proceed to task 3, it is crucial that you closely follow TryHackMe 's guide, as this task is highly specific to their platform.

Task 3 (Introduction to flags and switches)



Terminal commands often accept arguments, which can be provided by using a hyphen ('-') followed by a keyword, commonly referred to as flags or switches.

By default, commands perform their usual behavior. For example, the "ls" command displays the contents of the current directory without showing hidden files. To modify command behavior 

By using the -a option (--all), our output now includes additional files and folders, such as ".hiddenfolder". Note that files and folders starting with a dot (.) are hidden.

If you need assistance with commands that accept these, simply use the --help option. This handy feature will display a list of possible options, along with a brief description and an example of how to use them.

The manual pages are an excellent way to learn about system commands and applications on a Linux machine, whether you're accessing it on the machine or online. To access this documentation, use the man command and specify the command you want to read about.


# Explore the manual page of the ls command

Answer: Done

# What directional arrow key would we use to navigate down the manual page?

Answer: Done

# What flag would we use to display the output in a “human-readable” way?

Answer: -h



Task 4 (Filesystem Interaction Continued)

Get ready to discover new commands! In this room, we'll be delving into the world of creating, moving, and deleting files and folders. Let's explore the following commands:
  • touch — Creates a file
  • mkdir — Creates a directory
  • copy — Copies a file or folder
  • mv — Moves a file or folder
  • rm — Removes a file or folder
  • type — Outputs the type of a file

Creating Files and Folders (touch, mkdir)



Creating files and folders on Linux is easy. To create a file, use the touch command followed by the desired name. For example, touch infocodx creates an empty file named "infocodx".

Creating a folder involves using the mkdir command and specifying the desired name for the directory.


Removing Files and Folders

You can simply remove files by using rm. If you want to remove folders though, you need to add the -R switch alongside the name of the directory you wish to remove.


Determining File Type

We use file to determine the file type of a file:

find file type in  linux



# How would you create the file named “newnote”?

Answer: touch newnot

# On the deployable machine, what is the file type of “unknown1” in “tryhackme ’s” home directory?

Answer: 
tryhackme unknown 1



# How would we move the file “myfile” to the directory “myfolder”

Answer: mv myfile myfolder

# What are the contents of this file?

Answer: 
tryhackme flag


# Continue to apply your knowledge and practice the commands from this task.

Answer: No answer needed

Task 5 (Permissions 101)



We can use the command ls -lh to list the permissions of all files in a folder.

ls -lh | linux



Although intimidating, these three columns are very important in determining certain characteristics of a file or folder and whether or not we have access to it. A file or folder can have a couple of characteristics that determine both what actions are allowed and what user or group has the ability to perform:

  • Read
  • Write
  • Execute

It has the “-” indicator highlighting that it is a file and then “rw” followed after. This means that only the owner of the file can read and write to this file but cannot execute it.

These symbols appear in three sets, corrosponding to different groups. They are grouped based on their ownership level (examples from ls -lh above):

1. Owner (rw-)
2. Group (r--)
3. Other (r--)

 Switching User Profiles


Switching between users on Linux with su is easy, but if you lack root permissions, remember two things for a seamless transition.

  • The user we wish to switch to
  • The user’s password

# On the deployable machine, who is the owner of “important”?

Answer: user2

# What would the command be to switch to the user “user2”?

Answer: su user2

# Output the contents of “important”, what is the flag?

Answer: 
important


Task 6 (Common Directories)



 Familiarizing yourself with the common directories in Linux is a must.

/etc

This root directory is one of the most important root directories on your system. The etc folder (short for etcetera) is a commonplace location to store system files that are used by your operating system.

For example, the sudoers file contains a list of the users & groups that have permission to run sudo or a set of commands as the root user. Also important are the “passwd” and “shadow” files. These two files are special for Linux as they show how your system stores the passwords for each user in a hash formatting called sha512.

/var

The “/var” directory, with “var” being short for variable data, stores data that is frequently accessed or written by services or applications running on the system. For example, log files from running services and applications are written here (/var/log), or other data that is not necessarily associated with a specific user (i.e., databases and the like).

/root

There isn’t anything more to this folder other than just understanding that this is the home directory for the “root” user. You might assume that the root user would have their data in a directory such as “/home/root” by default, but this is not the case.

/tmp

This is a unique root directory found on a Linux install. Short for “temporary”, the /tmp directory is used to store data that is only needed to be accessed once or twice. Similar to the memory on your computer, once the computer is restarted, the contents of this folder are cleared out. What’s useful for us in pentesting is that any user can write to this folder by default. Meaning once we have access to a machine, it serves as a good place to store things like our enumeration scripts.


# What is the directory path that would we expect logs to be stored in?

Answer: /var/log

# What root directory is similar to how RAM on a computer works?

Answer: /tmp
# Name the home directory of the root user
Answer: /root
# Now apply your learning and navigate through these directories on the deployed Linux machine.
Answer: No answer needed.
Task 7 (Conclusions and Summaries)

 

Mission accomplished! I trust you've learned just as much as I have through writing this summary. Thank you for your readership



"I welcome any comments or feedback you may have. Feel free to share your thoughts below. Thank you again for your time and consideration!"

 

Comments

Popular posts from this blog

Storm-Breaker, enables the utilization of social engineering techniques to access webcams, microphones, and location finders

  Phishing represents a cyber attack method in which attackers aim to deceive individuals into revealing their personal information, such as login credentials or credit card numbers, by posing as a reputable entity, such as a bank or a social media platform. This fraudulent activity typically occurs through emails, text messages, or social media posts that contain a link to a counterfeit website or request personal information. Phishing attacks can be highly sophisticated and challenging to detect, often resulting in serious consequences like financial loss, identity theft, or unauthorized access to sensitive data. It is crucial to be vigilant about the signs of a phishing attack and take measures to protect both yourself and your personal information. Storm-Breaker  a command-line tool written in python, has garnered a strong following within the social engineering community. Its primary purpose is to provide access to webcams , microphones , and location finders . Setting up Storm-

Mr Robot 1 | Vulnhub.com CTF Walkthrough | INFOCODX

My write-up for Mr-Robot: 1 at Vulnhub.com is as follows. About vulnhub.com Vulnhub is a website that caters to the security community and provides them with training environments. It presents a diverse range of virtual machines and networks that can be downloaded to enhance one's cybersecurity skills in both offensive and defensive aspects. Disclaimer: The information, techniques, and tools presented in this document are intended solely for educational purposes. Any utilization of the content within this document is at your own discretion, and I cannot be held accountable for any harm inflicted upon systems or individuals legally. Engaging in the unauthorized use of the tools and techniques outlined in this document to target individuals or organizations is strictly prohibited by law. It is your responsibility to adhere to all relevant local, state, and federal regulations. I disclaim any liability and will not be held responsible for any misuse or harm resulting from the applica