Skip to content

Latest commit

 

History

History
792 lines (595 loc) · 15.4 KB

File metadata and controls

792 lines (595 loc) · 15.4 KB

Troubleshooting Guide - Password Cracking Lab

📋 Table of Contents

  1. Network Connectivity Issues
  2. SSH Connection Problems
  3. VirtualBox Configuration Issues
  4. File Transfer Problems
  5. John the Ripper Issues
  6. User Account Problems
  7. Performance Issues
  8. General Linux Troubleshooting

Network Connectivity Issues

❌ Problem: Cannot Ping Ubuntu Server from Kali Linux

Symptoms:

ping 192.168.56.102
# ping: connect: Network is unreachable

Solution 1: Check Network Adapters

# On Kali Linux
ip addr show

# Look for the Host-only adapter (usually eth1 or ens37)
# If it doesn't have an IP address:
sudo dhclient eth1

# Or configure static IP:
sudo ip addr add 192.168.56.25/24 dev eth1
sudo ip link set eth1 up

Solution 2: Verify VirtualBox Network Settings

  1. Shut down both VMs
  2. In VirtualBox Manager, check both VMs:
    • Settings → Network → Adapter 2
    • Ensure "Host-only Adapter" is selected
    • Ensure "vboxnet0" is chosen
    • ☑ "Cable Connected" is checked
  3. Restart VMs

Solution 3: Restart Networking

# On Kali Linux
sudo systemctl restart networking

# Or use NetworkManager
sudo systemctl restart NetworkManager

# On Ubuntu Server
sudo netplan apply

❌ Problem: "Network is Unreachable" Error

Symptoms:

ssh -p 2222 student@192.168.56.102
# ssh: connect to host 192.168.56.102 port 2222: Network is unreachable

Solution 1: Check Routing Table

# On Kali Linux
ip route

# You should see a route like:
# 192.168.56.0/24 dev eth1 proto kernel scope link src 192.168.56.X

# If missing, add it manually:
sudo ip route add 192.168.56.0/24 dev eth1

Solution 2: Verify Interface is UP

# Check interface status
ip link show eth1

# If it shows "DOWN", bring it up:
sudo ip link set eth1 up

Solution 3: Check Firewall on Host Machine

# On Linux host
sudo iptables -L -v -n | grep 192.168.56

# If blocked, allow traffic:
sudo iptables -I INPUT -s 192.168.56.0/24 -j ACCEPT
sudo iptables -I OUTPUT -d 192.168.56.0/24 -j ACCEPT

# On Windows host
# Check Windows Defender Firewall settings
# Add inbound rule for VirtualBox Host-Only Network

❌ Problem: Ubuntu Server Has No IP Address

Symptoms:

# On Ubuntu Server
ip addr show enp0s3
# Shows no inet address

Solution 1: Configure Netplan

# Check current netplan configuration
sudo cat /etc/netplan/*.yaml

# Edit the configuration
sudo nano /etc/netplan/00-installer-config.yaml

# Add or modify:
network:
  version: 2
  ethernets:
    enp0s3:
      dhcp4: true
      # OR for static IP:
      # addresses:
      #   - 192.168.56.102/24

# Apply changes
sudo netplan apply

# Debug if issues persist
sudo netplan --debug apply

Solution 2: Manual IP Assignment (Temporary)

# Assign IP manually
sudo ip addr add 192.168.56.102/24 dev enp0s3
sudo ip link set enp0s3 up

# Add default route if needed
sudo ip route add default via 192.168.56.1

SSH Connection Problems

❌ Problem: "Connection Refused" on Port 2222

Symptoms:

ssh -p 2222 student@192.168.56.102
# ssh: connect to host 192.168.56.102 port 2222: Connection refused

Solution 1: Verify SSH is Running

# On Ubuntu Server
sudo systemctl status sshd

# If not running, start it:
sudo systemctl start sshd
sudo systemctl enable sshd

# Check if listening on port 2222
sudo ss -tlnp | grep 2222
# Should show: LISTEN 0.0.0.0:2222

Solution 2: Check SSH Configuration

# On Ubuntu Server
sudo nano /etc/ssh/sshd_config

# Ensure these settings:
Port 2222
ListenAddress 0.0.0.0
PermitRootLogin no
PasswordAuthentication yes

# Restart SSH after changes
sudo systemctl restart sshd

Solution 3: Check Firewall Rules

# On Ubuntu Server
sudo ufw status

# If active and blocking, allow port 2222:
sudo ufw allow 2222/tcp
sudo ufw reload

# Check again
sudo ufw status numbered

❌ Problem: "Permission Denied (publickey)"

Symptoms:

ssh -p 2222 student@192.168.56.102
# Permission denied (publickey).

Solution 1: Enable Password Authentication

# On Ubuntu Server
sudo nano /etc/ssh/sshd_config

# Find and set:
PasswordAuthentication yes
PubkeyAuthentication yes
ChallengeResponseAuthentication yes

# Restart SSH
sudo systemctl restart sshd

Solution 2: Force Password Authentication from Client

# On Kali Linux
ssh -p 2222 -o PreferredAuthentications=password student@192.168.56.102

# Or disable pubkey for this connection:
ssh -p 2222 -o PubkeyAuthentication=no student@192.168.56.102

❌ Problem: "Too Many Authentication Failures"

Symptoms:

ssh -p 2222 student@192.168.56.102
# Received disconnect from 192.168.56.102: Too many authentication failures

Solution:

# On Kali Linux - limit identity files
ssh -p 2222 -o IdentitiesOnly=yes -o PreferredAuthentications=password student@192.168.56.102

# Or create SSH config
nano ~/.ssh/config

# Add:
Host ubuntu-target
    HostName 192.168.56.102
    Port 2222
    User student
    IdentitiesOnly yes
    PreferredAuthentications password

# Connect using:
ssh ubuntu-target

VirtualBox Configuration Issues

❌ Problem: VirtualBox Host-Only Network Not Showing

Symptoms:

  • vboxnet0 doesn't appear in VirtualBox Network Manager
  • Cannot select Host-only Adapter in VM settings

Solution 1: Create Host-Only Network

# On Linux host
VBoxManage hostonlyif create
VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0

# Verify
VBoxManage list hostonlyifs

Solution 2: Reinstall VirtualBox Network Drivers

# On Linux host
sudo /sbin/vboxconfig

# Or reinstall VirtualBox kernel modules
sudo apt remove --purge virtualbox-dkms
sudo apt install virtualbox-dkms

# Restart VirtualBox services
sudo systemctl restart vboxdrv

Solution 3: Windows Host - Reinstall Adapter

  1. Open Device Manager
  2. Network Adapters → VirtualBox Host-Only Ethernet Adapter
  3. Right-click → Uninstall
  4. Restart VirtualBox
  5. File → Host Network Manager → Create

❌ Problem: VM Won't Start - "VT-x is Disabled"

Symptoms:

VT-x is disabled in the BIOS for all CPU modes

Solution:

  1. Restart computer and enter BIOS (F2, F10, Del, or F12)
  2. Navigate to CPU/Processor settings
  3. Enable:
    • Intel VT-x (Intel CPUs)
    • AMD-V (AMD CPUs)
    • Virtualization Technology
  4. Save and exit BIOS
  5. Try starting VM again

For Windows 10/11:

# Disable Hyper-V (conflicts with VirtualBox)
bcdedit /set hypervisorlaunchtype off
# Restart computer

❌ Problem: VM Running Very Slow

Symptoms:

  • VM takes minutes to boot
  • Commands are extremely slow
  • High CPU usage on host

Solution 1: Increase VM Resources

  1. Shut down VM
  2. Settings → System
    • Increase RAM (minimum 2GB for Ubuntu Server, 4GB for Kali)
    • Increase CPU cores (2-4 cores)
  3. Settings → Display
    • Increase Video Memory to 128MB
    • ☑ Enable 3D Acceleration

Solution 2: Disable Unnecessary Services

# On Ubuntu Server
sudo systemctl disable --now snapd
sudo systemctl disable --now bluetooth
sudo apt autoremove --purge

Solution 3: Enable VT-x/AMD-V (see above)


File Transfer Problems

❌ Problem: SCP "Permission Denied" on shadow.lab

Symptoms:

scp -P 2222 student@192.168.56.102:/home/student/shadow.lab .
# Permission denied

Solution:

# On Ubuntu Server, fix permissions
sudo chown student:student /home/student/shadow.lab
sudo chmod 644 /home/student/shadow.lab

# Verify
ls -l /home/student/shadow.lab
# Should show: -rw-r--r-- student student

❌ Problem: SCP "No Such File or Directory"

Symptoms:

scp -P 2222 student@192.168.56.102:/home/student/passwd.lab .
# /home/student/passwd.lab: No such file or directory

Solution 1: Verify File Exists

# SSH into Ubuntu Server
ssh -p 2222 student@192.168.56.102

# Check if files exist
ls -l /home/student/*.lab

# If missing, create them:
cp /etc/passwd ~/passwd.lab
sudo cp /etc/shadow ~/shadow.lab
sudo chown student:student ~/shadow.lab

Solution 2: Use Absolute Path

# Instead of relative path, use full path
scp -P 2222 student@192.168.56.102:/home/student/passwd.lab ~/lab/

❌ Problem: SCP Shows Wrong Syntax Error

Symptoms:

scp -p 2222 student@192.168.56.102:/home/student/passwd.lab .
# scp: stat local "2222": No such file or directory

Solution:

# Use CAPITAL P for port, not lowercase p
# Lowercase p preserves file attributes
# CORRECT:
scp -P 2222 student@192.168.56.102:/home/student/passwd.lab .

# INCORRECT:
scp -p 2222 student@192.168.56.102:/home/student/passwd.lab .

John the Ripper Issues

❌ Problem: "No Password Hashes Loaded"

Symptoms:

john unshadow.txt
# No password hashes loaded

Solution 1: Check unshadow.txt Format

# View file contents
cat unshadow.txt

# Should look like:
# username:$6$salt$hash:uid:gid:comment:home:shell

# If empty or incorrect, recreate:
unshadow passwd.lab shadow.lab > unshadow.txt

Solution 2: Verify Hash Format

# Check for valid hashes
grep '^\w*:\$' unshadow.txt

# If no matches, shadow.lab might be corrupted
# Re-copy from Ubuntu Server

❌ Problem: John the Ripper is Very Slow

Symptoms:

john --wordlist=rockyou.txt unshadow.txt
# Speed: 10 p/s (should be 500-1000+ p/s)

Solution 1: Check Hash Type

# Show detected hash types
john unshadow.txt

# yescrypt hashes are intentionally slow
# SHA-512 ($6$) should be faster

# Force specific format if needed:
john --format=sha512crypt --wordlist=rockyou.txt unshadow.txt

Solution 2: Use More CPU Cores

# Check available cores
nproc

# Force John to use all cores
john --fork=4 --wordlist=rockyou.txt unshadow.txt

Solution 3: Use Hashcat (GPU Acceleration)

# Install Hashcat
sudo apt install hashcat

# Extract hash
grep student unshadow.txt | cut -d: -f2 > student.hash

# Crack with GPU
hashcat -m 1800 -a 0 student.hash /usr/share/wordlists/rockyou.txt

❌ Problem: RockYou Wordlist Not Found

Symptoms:

john --wordlist=/usr/share/wordlists/rockyou.txt unshadow.txt
# fopen: /usr/share/wordlists/rockyou.txt: No such file or directory

Solution:

# Locate the file
locate rockyou.txt

# If compressed, extract it
sudo gunzip /usr/share/wordlists/rockyou.txt.gz

# If missing completely, download it
wget https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt
sudo mv rockyou.txt /usr/share/wordlists/

❌ Problem: "Loaded 0 password hashes" but File Has Hashes

Symptoms:

john unshadow.txt
# Loaded 0 password hashes (no hashes match)

Solution:

# Check for already-cracked hashes
john --show unshadow.txt

# If all shown as cracked, remove john.pot
rm ~/.john/john.pot

# Try again
john --wordlist=rockyou.txt unshadow.txt

User Account Problems

❌ Problem: Cannot Create User - "User Already Exists"

Symptoms:

sudo useradd -m student
# useradd: user 'student' already exists

Solution 1: Delete Existing User

# Delete user and home directory
sudo userdel -r student

# Recreate
sudo useradd -m -s /bin/bash student
echo 'student:student' | sudo chpasswd

Solution 2: Just Update Password

# Keep existing user, change password
echo 'student:student' | sudo chpasswd

❌ Problem: User Has No Home Directory

Symptoms:

ssh -p 2222 student@192.168.56.102
# Could not chdir to home directory /home/student: No such file or directory

Solution:

# On Ubuntu Server
# Create home directory manually
sudo mkdir -p /home/student
sudo cp -r /etc/skel/. /home/student/
sudo chown -R student:student /home/student
sudo chmod 755 /home/student

❌ Problem: Password Won't Change

Symptoms:

sudo passwd student
# passwd: Authentication token manipulation error

Solution:

# Remount filesystem as read-write
sudo mount -o remount,rw /

# Try again
sudo passwd student

# Or use chpasswd
echo 'student:newpassword' | sudo chpasswd

Performance Issues

❌ Problem: Kali Linux Running Out of Memory

Symptoms:

  • System freezes
  • Applications crash
  • "Out of memory" errors

Solution 1: Increase VM RAM

  1. Shut down VM
  2. VirtualBox Settings → System → Base Memory
  3. Increase to 4GB minimum (6-8GB recommended)
  4. Click OK and restart

Solution 2: Add Swap Space

# Create 2GB swap file
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

# Make permanent
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

# Verify
free -h

❌ Problem: Disk Space Full

Symptoms:

# No space left on device

Solution:

# Check disk usage
df -h

# Find large files
sudo du -sh /* | sort -hr | head -10

# Clean up
sudo apt autoremove
sudo apt clean
sudo journalctl --vacuum-size=100M

# Remove old kernels (Ubuntu)
sudo apt autoremove --purge

General Linux Troubleshooting

❌ Problem: "Command Not Found"

Solution:

# Update PATH
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Add to .bashrc for permanent fix
echo 'export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' >> ~/.bashrc
source ~/.bashrc

# Or install missing package
sudo apt update
sudo apt install <package-name>

❌ Problem: "Operation Not Permitted" Even with sudo

Solution:

# Check if file is immutable
lsattr filename

# Remove immutable flag if needed
sudo chattr -i filename

# Or check AppArmor/SELinux
sudo aa-status
sudo setenforce 0  # For SELinux

🆘 Getting More Help

Enable Verbose/Debug Mode

SSH Debugging:

ssh -vvv -p 2222 student@192.168.56.102

John the Ripper Debugging:

john --verbosity=5 unshadow.txt

Network Debugging:

# Packet capture
sudo tcpdump -i eth1 -n host 192.168.56.102

# Trace route
traceroute 192.168.56.102

Log Files to Check

# SSH logs (Ubuntu)
sudo tail -f /var/log/auth.log

# System logs
sudo journalctl -xe

# Kali logs
sudo tail -f /var/log/syslog

Reset to Clean State

If all else fails, reset your lab:

# Take snapshot before major changes
VBoxManage snapshot "VM-Name" take "BeforeChanges"

# Restore snapshot if needed
VBoxManage snapshot "VM-Name" restore "BeforeChanges"

# Or delete VMs and start fresh

📚 Additional Resources


Still Having Issues?

  1. Check VirtualBox and SSH log files
  2. Verify all steps in LAB-SETUP.md were followed
  3. Try the setup on a different host machine
  4. Join cybersecurity Discord communities for real-time help
  5. Create GitHub issue with detailed error logs