Skip to the content.

đź”— Link to the Room

🏷️ Table of Contents

  1. Learning Objectives
  2. Physical Security
  3. Filesystem Partitioning and Encryption
  4. Firewall
    4.1 Key points
  5. Remote Access
    5.1 Key protections
  6. Securing User Accounts
    6.1 Best practices
  7. Software and Services
  8. Update and Upgrade Policies
    8.1 Key points
  9. Audit and Log Configuration
    9.1 Key takeaways

📚 Study Notes

Learning Objectives

image

 

Physical Security

 

[!WARNING] GRUB passwords aren’t useful for cloud servers, since you can’t access the physical machine.

 

 

[!NOTE]

 


âť“ What command can you use to create a password for the GRUB bootloader?grub2-mkpasswd-pbkdf2

✅Solution: It’s a tool that creates a secure password hash for GRUB, so only authorized users can change boot settings or access root. —

❓What does PBKDF2 stand for? Password-Based Key Derivation Function 2

 

Filesystem Partitioning and Encryption

 

[!NOTE]

 

 


❓What does LUKS stand for?Linux Unified Key Setup

❓We cannot attach external storage to the VM, so we have created a /home/tryhackme/secretvault.img file instead. It is encrypted with the password 2N9EdZYNkszEE3Ad. To access it, you need to open it using cryptsetup and then mount it to an empty directory, such as myvault. What is the flag in the secret vault?THM{****_***_***}

✅Solution: Check the Question Hint provided by THM: sudo cryptsetup open --type luks secretvault.img myvault && sudo mount /dev/mapper/myvault myvault/. Then you can read your flag with command cat task3_flag.txt —

 

Firewall

Key points

 

[!NOTE]

 

[!CAUTION] Firewalls are essential for Linux security, but rules must be planned carefully, especially as exceptions grow.

 


❓There is a firewall running on the Linux VM. It is allowing port 22 TCP as we can ssh into the machine. It is allowing another TCP port; what is it?12526

✅Solution: Run command sudo ufw status —

❓What is the allowed UDP port?14298

✅Solution: It’s in the previous output. —

 

Remote Access

Key protections

 

[!IMPORTANT] Using SSH keys instead of passwords makes remote access secure and reduces the risk of attackers guessing credentials.

 

[!NOTE]

 


❓What flag is hidden in the sshd_config file? THM{******_***_*****}

✅Solution: Use command: cat /etc/ssh/sshd_config —

 

Securing User Accounts

image

 

Best practices

 

[!IMPORTANT] Limiting root usage, enforcing strong passwords, and disabling unused accounts greatly reduces the risk of system compromise.

 

[!NOTE]

 


❓One way to disable an account is to edit the `passwd` file and change the account’s shell. What is the suggested value to use for the shell?/sbin/nologin

✅Solution: On Linux, each user account has a login shell defined in the /etc/passwd file. The shell determines what program runs when the user logs in. To disable an account without deleting it, you can change its shell to a special value that prevents interactive logins. This means the user or service cannot open a shell session, effectively disabling their ability to log in while keeping the account intact for system purposes instead of removing the account. —

❓What is the name of the RedHat and Fedora systems sudoers group?wheel

❓What is the name of the sudoers group on Debian and Ubuntu systems?sudo

❓Other than tryhackme and ubuntu, what is the username that belongs to the sudoers group?blacksmith

✅Solution: Run commmand: cat /etc/group | grep sudo —

 

Software and Services

 


❓Besides FTPS, what is another secure replacement for TFTP and FTP? SFTP

✅Solution: Secure File Transfer Protocol, a safe way to transfer files over SSH. —

 

Update and Upgrade Policies

Key points

 

[!IMPORTANT] Keeping both software and the kernel up-to-date significantly reduces the risk of attacks.

 

image

 


❓What command would you use to update an older Red Hat system?yum update

❓What command would you use to update a modern Fedora system?dnf update

❓What two commands are required to update a Debian system? (Connect the two commands with &&.)apt update && apt upgrade

❓What does yum stand for?Yellowdog Updater, Modified

❓What does dnf stand for?Dandified YUM

❓What flag is hidden in the sources.list file?THM{***_********_**********_******}

✅Solution: Run find / -type f -name sources.list 2>/dev/null to find the file, then read it with cat /etc/apt/sources.list to read the flag. <!– THM{not_Advanced_Persistent_Threat} –) —

 

Audit and Log Configuration

path explanation
/var/log/messages a general log for Linux systems
/var/log/auth.log a log file that lists all authentication attempts (Debian-based systems)
/var/log/secure a log file that lists all authentication attempts (Red Hat and Fedora-based systems)
/var/log/utmp an access log that contains information regarding users that are currently logged into the system
/var/log/wtmp an access log that contains information for all users that have logged in and out of the system
/var/log/kern.log a log file containing messages from the kernel
/var/log/boot.log a log file that contains start-up messages and boot information

 


❓What command can you use to display the last 15 lines of kern.log?tail -n 15 kern.log

❓What command can you use to display the lines containing the word denied in the file secure?grep denied secure

 

Key takeaways

 

[!IMPORTANT] Following these basic guidelines helps maintain a secure and well-managed Linux system, and the level of documentation may grow with the size of your environment.