Set Up SSH Server
In this step, we will set up a basic SSH server on the LabEx VM. SSH (Secure Shell) is a cryptographic network protocol for operating network services securely over an unsecured network. It's commonly used for remote command-line login and remote command execution.
First, we need to install the OpenSSH server. OpenSSH is a suite of security-related network-level tools based on the Secure Shell protocol, and it's the most common SSH implementation.
Open a terminal in the LabEx VM. You can use the default Xfce terminal.
Execute the following command to update the package lists:
sudo apt update
This command synchronizes the package index files from their sources. It's a good practice to run this before installing any new software. You might be prompted for your password, but remember that the labex
user has sudo
privileges without a password.
Next, install the OpenSSH server:
sudo apt install openssh-server -y
The -y
flag automatically answers "yes" to any prompts during the installation, making the process non-interactive.
After the installation is complete, the SSH server should start automatically. You can check its status using the following command:
sudo systemctl status ssh
You might see an error message like System has not been booted with systemd as init system (PID 1). Can't operate.
This is because the LabEx VM runs in a Docker container, which doesn't use systemd
. Don't worry, the SSH server is still running.
To confirm that the SSH server is running, you can check if the SSH port (port 22) is listening. Use the netstat
command:
netstat -tulnp | grep 22
You should see output similar to this:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
This indicates that the SSH server is listening on port 22 for both IPv4 and IPv6 connections.
Now that the SSH server is set up, you can connect to it from another machine using an SSH client. However, for this lab, we will focus on using Hydra to crack the SSH password.