Ever wondered how hackers actually break into computers? In this hands-on lab guide, we walk you through exactly how a hacker uses Kali Linux — the world’s most popular hacking operating system — to break into a vulnerable Linux machine called Metasploitable 2. Think of Metasploitable 2 as a “practice dummy” that is deliberately left wide open so you can learn hacking safely and legally. We cover four real hacking techniques: SSH, FTP, rlogin, and Telnet — all explained in plain English with real screenshots at every step. No prior hacking experience needed.

Kali Linux attacker and Metasploitable 2 victim side by side
Figure 1.1 — Lab Setup: Kali Linux (Attacker) on the left & Metasploitable 2 (Victim) on the right — both running simultaneously in VirtualBox
⚠️

⚠ Important Warning: Everything in this guide is done inside a safe, private lab using a fake “dummy” machine that is designed to be hacked. Never try this on real computers, websites, or networks you do not own. Hacking real systems without permission is a serious crime in Australia and worldwide. This is purely for learning in a classroom environment.

Before we start hacking, we need two computers — one to attack from and one to attack. We run both as virtual machines (like apps) inside VirtualBox on the same laptop. Kali Linux is our hacker machine and Metasploitable 2 is our victim. The victim’s address on our private network is 10.175.53.252 — think of this like the victim’s home address we will be knocking on.

Kali
Attack Machine
kali-linux-2025.2
Meta2
Target Machine
Metasploitable 2
10.175
Target IP
10.175.53.252
VBox
Oracle VirtualBox
Hypervisor

Default Credentials

credentials
# Default login for Metasploitable 2 Username : msfadmin Password : msfadmin
🔍
💡 Think of it this way: Imagine the victim machine is a big office building. Every port is like a numbered entrance. Nmap is like a security guard who walks around and checks which ports are open. Our victim (Metasploitable 2) has left a shocking number of ports wide open — 14 open ports! Each open port is a different way we can get inside. A real hacker would scan first, then pick the easiest open port to exploit.

Before a hacker breaks in, they first scan the target machine checking which ports are open. Hackers do exactly the same thing — but with a tool called Nmap. It knocks on every port of the victim machine and tells us which ones are open. Each open port is a potential entry point. Let’s run it and see what we find on our victim machine.

root@kali — nmap
# Discover hosts on subnet root@kali:~# nmap -sn 10.175.53.0/24 # Service version detection root@kali:~# nmap -sV 10.175.53.252 # Scan all 65535 ports root@kali:~# nmap -p- 10.175.53.252
Nmap scan results on Metasploitable 2
Figure 2.1 — Nmap scan output showing all open TCP ports on Metasploitable 2 (10.175.53.252)
21
FTP (vsFTPd 2.3.4)
open
22
SSH (OpenSSH 4.7)
open
23
Telnet
open
25
SMTP
open
80
HTTP (Apache)
open
139
NetBIOS-SSN
open
445
SMB (Samba)
open
512
rexec
open
513
rlogin
open
514
rsh (shell)
open

SSH is like a secret back port into a computer. Once you are in, you get a full command line — you can run any command, read files, create users, basically do anything. Our victim machine uses a very old version of SSH with outdated security settings, which means we need a couple of extra tricks to connect. But once we do — we’re in.

🔑
💡 Think of it this way: SSH is like a master key to a house. Once you have the right key (username + password), you can walk straight in and do whatever you want. Our victim machine has left the default password msfadmin unchanged — like someone who never changed the factory PIN on their phone. This is one of the most common reasons real systems get hacked. We will also hit a small technical roadblock because our Kali is modern and the victim uses an ancient SSH version — but we fix it easily.

🔎 First: Confirm SSH Port is Open

port check
root@kali:~# nmap -p 22 10.175.53.252 22/tcp open ssh

🚨 The Problem: Old SSH Version on Victim

error
root@kali:~# ssh msfadmin@10.175.53.252 Unable to negotiate with 10.175.53.252 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

✅ The Fix: Force Kali to Speak the Old Language

root@kali — SSH fix
root@kali:~# ssh -o HostKeyAlgorithms=+ssh-rsa \ -o KexAlgorithms=+diffie-hellman-group1-sha1 \ -o PubkeyAcceptedKeyTypes=+ssh-rsa \ msfadmin@10.175.53.252 msfadmin@10.175.53.252's password: msfadmin Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 msfadmin@metasploitable:~$
Successful SSH login to Metasploitable 2
Figure 3.1 — Successful SSH login after adding legacy algorithm flags. Ubuntu banner confirms connection to Metasploitable 2

🏗 Save the Fix So You Don’t Retype It Every Time

~/.ssh/config
root@kali:~# nano ~/.ssh/config Host metasploitable HostName 10.175.53.252 User msfadmin HostKeyAlgorithms +ssh-rsa KexAlgorithms +diffie-hellman-group1-sha1 PubkeyAcceptedKeyTypes +ssh-rsa # Then simply run: root@kali:~# ssh metasploitable
💡

Why the + prefix? It appends to the existing list rather than replacing it, so modern SSH connections remain secure while adding legacy support for this lab target only.

FlagPurposeDisabled Since
HostKeyAlgorithms=+ssh-rsaRe-enables RSA host key verificationOpenSSH 8.8
KexAlgorithms=+diffie-hellman-group1-sha1Allows old key exchange methodOpenSSH 7.0
PubkeyAcceptedKeyTypes=+ssh-rsaAccepts RSA public key authOpenSSH 8.8
ssh-keygen -R 10.175.53.252Clear stale known_hosts entry
ssh -vvv ...Verbose debug to find failure point

FTP is used to transfer files between computers. The problem? It sends your username, password, and every file in plain text — like sending a postcard instead of a sealed letter. Anyone watching the network can read it all. Our victim is running an ancient FTP server with the default password still set. We will log in and prove we can upload files directly onto the victim machine.

📁
💡 Think of it this way: Imagine FTP as sending files through the post on a fully transparent postcard. The postman (and anyone else) can read exactly what is on it — including your password. Our victim’s FTP server still has the factory default password set to msfadmin. This is like a bank vault where the combination is written on a sticky note next to the server. We log in, navigate to a writable folder, and drop a file there — proving we have full write access to the victim’s machine.

🔑 Log Into the Victim’s FTP Server

root@kali — FTP login
root@kali:~# ftp 10.175.53.252 Connected to 10.175.53.252. 220 (vsFTPd 2.3.4) Name (10.175.53.252:kali): msfadmin 331 Please specify the password. Password: msfadmin 230 Login successful. ftp>

📤 Plant a File on the Victim Machine

create & upload
# Create test file on Kali (new terminal) root@kali:~# echo "Hello from Kali" > /root/testfile.txt # In FTP session — go to writable directory ftp> cd /tmp 250 Directory successfully changed. # Upload — specify remote filename as second argument ftp> put /root/testfile.txt testfile.txt 226 Transfer complete. 17 bytes sent. ftp> ls -rw-r--r-- 1 msfadmin msfadmin 17 testfile.txt
FTP session showing file transfer
Figure 4.1 — FTP session: 553 error when uploading to /root (no permission), then successful cd /tmp and transfer
📌

Key Point: Always provide the remote filename as the second argument: put /local/path/file.txt remotename.txt. Without it, FTP tries to recreate the full local path on the remote, which fails with error 553.

🔍 Confirm the File is on the Victim

msfadmin@metasploitable
# Directly on Metasploitable console: msfadmin@metasploitable:~$ ls -la /tmp/ -rw-r--r-- 1 msfadmin msfadmin 48 2026-05-28 19:43 testfile.txt msfadmin@metasploitable:~$ cat /tmp/testfile.txt Hello from Kali
CommandDescription
put /local/file.txt name.txtUpload file to current remote directory
get remotefile.txtDownload file to local machine
mput *.txtUpload multiple files
mget *Download all remote files
cd /tmpChange remote directory
lcd /rootChange local directory
ls / !lsList remote / local files
passiveToggle passive mode (fixes bind errors)
byeClose FTP session
⚠️

vsFTPd 2.3.4 Backdoor (CVE-2011-2523): Appending :) to any username triggers a backdoor that opens a root shell on port 6200. This is a classic Metasploit exercise. Never attempt this on any real system.

This one is shocking. rlogin is so old and so insecure that it can let you into a machine with no password at all if the victim trusts your IP address. Even when a password is used, it travels across the network in plain text for anyone to read. Metasploitable 2 has this ancient protocol running on port 513. We walk straight in with a single command.

🔓
💡 Think of it this way: Imagine a hotel that was built in the 1980s where the front entrance just opens automatically for anyone who says their name. No ID check, no key card — just walk in. That is rlogin. It was designed in an era when the internet was only used by trusted universities and nobody imagined strangers would be on the network. Today running this on a public network is like leaving port 513 permanently open with a welcome mat that says “please rob me.”

🔓 Walk Straight Into the Victim

root@kali — rlogin
# Install rlogin client root@kali:~# sudo apt install rsh-client -y # Connect root@kali:~# rlogin -l msfadmin 10.175.53.252 Last login: Thu May 28 19:21:22 EDT 2026 Linux metasploitable 2.6.24-16-server msfadmin@metasploitable:~$ whoami msfadmin
Successful rlogin to Metasploitable 2
Figure 5.1 — rlogin connection to Metasploitable 2 via port 513. whoami confirms msfadmin shell
Featurerlogin (513)SSH (22)
Encryption❌ None — plaintext✅ AES / ChaCha20
AuthenticationTrust-based or plaintextKey-pair or encrypted
Wireshark visible?Yes — everything readableNo — fully encrypted
StatusObsolete since ~1995Current standard

This is the easiest hack in the whole guide. One command, no flags, no tricks, and you are inside the victim machine with a full terminal. Telnet is so old (invented in 1969!) that it has absolutely no security built in. Everything — your password, every command you type, every result you see — travels across the network as plain readable text. It is the digital equivalent of shouting your bank PIN in a crowded shopping centre.

📱
💡 Think of it this way: Telnet is like having a phone call with someone in a completely open office where everyone around them can hear both sides of the conversation — including when you whisper your password. In 1969 this was fine because only a handful of universities were connected. Today it is one of the most dangerous protocols you can run on a network. Yet here it is on our victim machine, wide open on port 23, waiting for us. One command and we’re in.
root@kali — telnet
root@kali:~# telnet 10.175.53.252 Trying 10.175.53.252... Connected to 10.175.53.252. metasploitable login: msfadmin Password: msfadmin msfadmin@metasploitable:~$
Telnet login to Metasploitable 2
Figure 6.1 — Telnet connection showing the Metasploitable 2 ASCII banner and successful login
🔴

Critical Risk: Running tcpdump -i eth0 -A port 23 on the same network during a Telnet session will display every character typed — including passwords — in plaintext. This is why Telnet was replaced by SSH in the late 1990s.

ProtocolPortCommandNotes
Nmapnmap -sV 10.175.53.252Service version detection
Nmapnmap -p- 10.175.53.252All 65535 ports
SSH22ssh -o HostKeyAlgorithms=+ssh-rsa -o KexAlgorithms=+diffie-hellman-group1-sha1 msfadmin@10.175.53.252Legacy flags required
SSH22ssh-keygen -R 10.175.53.252Clear stale known_hosts
FTP21ftp 10.175.53.252Interactive FTP client
FTP21put /root/testfile.txt testfile.txtUpload to /tmp
FTP21get remotefile.txtDownload file
rlogin513rlogin -l msfadmin 10.175.53.252Needs rsh-client package
Telnet23telnet 10.175.53.252No flags needed
Netcatanync 10.175.53.252 <port>Raw TCP probe

🔒 Which Protocols Are Safe vs Dangerous?

ProtocolPortEncryptedStatusRisk
SSH22✅ YesCurrent standard🟢 Low
SFTP/SCP22✅ YesReplaces FTP🟢 Low
FTP21❌ NoDeprecated🔴 High
Telnet23❌ NoObsolete🔴 Critical
rlogin513❌ NoObsolete🔴 Critical
🎓

🎉 What Did We Just Learn? We just hacked into the same machine four different ways using four different open ports. Every single entry point we used existed because of the same two reasons: weak default passwords and old unencrypted protocols. In the real world, thousands of servers get hacked every day for exactly these reasons. The fix is simple — change default passwords immediately, disable old protocols like Telnet, FTP and rlogin, and use SSH with strong passwords or key-based authentication instead.


👥 Students Who Completed This Hack Lab
PT
Prabin Thapa
SS
Salina Shrestha
AA
Ashish Adhikari
SK
Sagar Khanal
SM
Sana Munir
RD
Roshan Das
JM
Jayash Raj Mudbhari
BJ
Babita Jaishi
BS
Bipin Shrestha
SL
Shristi Lamsal
SD
Sajjan Dahal