0
0
Raspberry Piprogramming~20 mins

Securing Raspberry Pi (SSH keys, firewall) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Raspberry Pi Security Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this SSH key generation command?
You run the command ssh-keygen -t ed25519 -C "pi@raspberry" on your Raspberry Pi. What will be the expected output message after successful key creation?
Raspberry Pi
ssh-keygen -t ed25519 -C "pi@raspberry"
A
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/pi/.ssh/id_ed25519):
Your identification has been saved in /home/pi/.ssh/id_ed25519.
Your public key has been saved in /home/pi/.ssh/id_ed25519.pub.
The key fingerprint is:
ed25519 SHA256:... pi@raspberry
The key's randomart image is:
+--[ED25519 256]--+
|                 |
|                 |
+----[SHA256]-----+
B
Generating RSA key pair.
Enter file in which to save the key (/home/pi/.ssh/id_rsa):
Your identification has been saved in /home/pi/.ssh/id_rsa.
Your public key has been saved in /home/pi/.ssh/id_rsa.pub.
The key fingerprint is:
RSA SHA256:... pi@raspberry
The key's randomart image is:
+--[RSA 2048]-----+
|                 |
|                 |
+----[SHA256]-----+
C
Error: Unsupported key type ed25519.
Please use rsa or dsa.
D
Permission denied (publickey).
Could not save the key.
Attempts:
2 left
💡 Hint
The command specifies the ed25519 key type, which is modern and supported.
Predict Output
intermediate
1:30remaining
What is the effect of this UFW firewall command on Raspberry Pi?
You run sudo ufw allow 22/tcp on your Raspberry Pi. What is the resulting firewall behavior?
Raspberry Pi
sudo ufw allow 22/tcp
ABlocks all incoming TCP connections on port 22.
BDisables the firewall completely.
CAllows incoming TCP connections on port 22 (SSH) through the firewall.
DAllows outgoing UDP connections on port 22.
Attempts:
2 left
💡 Hint
Port 22 is the default SSH port and TCP is the protocol used by SSH.
🔧 Debug
advanced
2:30remaining
Why does this SSH connection fail after disabling password authentication?
You disabled password authentication by setting PasswordAuthentication no in /etc/ssh/sshd_config but now cannot connect via SSH. What is the most likely cause?
Raspberry Pi
1. Edit /etc/ssh/sshd_config
2. Set PasswordAuthentication no
3. Restart ssh service
4. Try to SSH without an SSH key

Connection fails.
AThe firewall is blocking port 22.
BYou did not add your public SSH key to the Raspberry Pi's authorized_keys file.
CThe SSH server does not support key-based authentication.
DYou need to reboot the Raspberry Pi after changing sshd_config.
Attempts:
2 left
💡 Hint
Disabling password authentication requires key-based login to be set up first.
🧠 Conceptual
advanced
1:30remaining
What is the main security benefit of using SSH keys over passwords on Raspberry Pi?
Why is using SSH keys considered more secure than passwords for accessing your Raspberry Pi remotely?
ASSH keys automatically disable the firewall.
BSSH keys allow anyone to connect without authentication.
CPasswords are stored in plain text on the Raspberry Pi.
DSSH keys are cryptographically stronger and not vulnerable to brute-force guessing like passwords.
Attempts:
2 left
💡 Hint
Think about how passwords can be guessed but keys cannot.
Predict Output
expert
3:00remaining
What is the number of rules after these UFW commands?
You run these commands on your Raspberry Pi:
sudo ufw reset
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw enable
How many active rules will sudo ufw status numbered show?
Raspberry Pi
sudo ufw reset
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw enable
sudo ufw status numbered
A2
B3
C4
D5
Attempts:
2 left
💡 Hint
Count only the explicit allow rules added after reset.