Introduction to Linux Lab
Ubuntu Server LTS Lab Activity for Cybersecurity
Objective
This lab activity is designed to introduce undergraduate cybersecurity students to Ubuntu Server LTS, focusing on basic system administration, security configurations, and common cybersecurity tools in a server environment.
Prerequisites
VMware Workstation Player installed on your computer
Ubuntu Server 22.04 LTS ISO file downloaded (or the latest LTS version available)
Part 1: Setting up the Ubuntu Server Virtual Machine
Step 1: Create a New Virtual Machine
Open VMware Workstation Player
Click on "Create a New Virtual Machine"
Choose "Installer disc image file (iso)" and select your Ubuntu Server ISO
Follow the wizard, allocating at least 20GB of disk space and 2GB of RAM
Step 2: Install Ubuntu Server
Start the virtual machine and follow the Ubuntu Server installation prompts
Choose to install Ubuntu Server (minimized installation)
Configure network settings (DHCP is usually fine for this lab)
Set up a username and password for the administrator account
Choose to install OpenSSH server when prompted
Do not select any additional featured server snaps
Step 3: Update the System
After installation, log in with your credentials
Update the package list and upgrade installed packages:
sudo apt update sudo apt upgrade -y
Part 2: Basic System Administration
Step 1: User Management
Create a new user:
sudo adduser securitystudent
Add the new user to the sudo group:
sudo usermod -aG sudo securitystudent
Switch to the new user:
su - securitystudent
Step 2: File Permissions
Create a directory and a file:
mkdir securefiles echo "This is a secret" > securefiles/secret.txt
Change permissions:
chmod 700 securefiles chmod 600 securefiles/secret.txt
Verify permissions:
ls -l securefiles ls -l securefiles/secret.txt
Part 3: Basic Security Configurations
Step 1: Configure the Firewall
Check firewall status:
sudo ufw status
Enable the firewall:
sudo ufw enable
Allow SSH:
sudo ufw allow ssh
Step 2: Secure SSH
Edit SSH configuration:
sudo nano /etc/ssh/sshd_config
Make the following changes:
Change
PermitRootLogin
tono
Set
PasswordAuthentication
tono
Set
MaxAuthTries
to3
Restart SSH service:
sudo systemctl restart ssh
Part 4: Installing and Using Cybersecurity Tools
Step 1: Install Nmap
Install Nmap:
sudo apt install nmap -y
Perform a basic scan (replace with a safe, authorized IP):
sudo nmap 192.168.1.1
Step 2: Install and Configure Fail2ban
Install Fail2ban:
sudo apt install fail2ban -y
Copy the configuration file:
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Edit the configuration:
sudo nano /etc/fail2ban/jail.local
Find the
[sshd]
section and setenabled = true
Restart Fail2ban:
sudo systemctl restart fail2ban
Part 5: Log Analysis
Step 1: Examine System Logs
View the system log:
sudo less /var/log/syslog
Search for SSH-related entries:
sudo grep sshd /var/log/auth.log
Step 2: Monitor Real-time Logs
Use the
tail
command to monitor logs in real-time:sudo tail -f /var/log/auth.log
In another terminal or from another machine, attempt to SSH into the server and observe the log entries
Part 6: Basic Web Server Setup
Step 1: Install Apache Web Server
Install Apache:
sudo apt install apache2 -y
Allow HTTP traffic through the firewall:
sudo ufw allow 'Apache'
Step 2: Configure a Basic Web Page
Edit the default web page:
sudo nano /var/www/html/index.html
Add some basic HTML content:
<html> <body> <h1>Welcome to my secure server!</h1> </body> </html>
Save and exit the editor
Step 3: Access the Web Server
From another machine on the network, open a web browser and navigate to the IP address of your Ubuntu Server
Conclusion
In this lab, you've learned how to set up an Ubuntu Server LTS virtual machine, perform basic system administration tasks, configure security settings, install and use common cybersecurity tools, and analyze system logs. You've also optionally set up a basic web server. These skills form a foundation for further exploration of Linux servers in cybersecurity contexts.
Last updated