SSH - Weber-State-Submarine-Project/Submarine GitHub Wiki
Setting Up SSH
To SSH into any Ubuntu computer, including the Raspberry Pi, you must set up the OpenSSH Server.
Steps to Install & Setup:
-
Update the System:
Run the following commands:sudo apt update sudo apt upgrade -
Install the OpenSSH Server:
Run the following command:sudo apt install openssh-server -
Configure Firewall Rules for SSH:
Check the status of UFW:sudo ufw status. If UFW is inactive, enable it with the following command:sudo ufw enable. Next, allow inbound SSH connections to the firewall:sudo ufw allow ssh -
Change the Default SSH Port:
Typically, the default port is 22, but we will be changing it to increase security. First, backup the original SSH config:sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bakThen, access the config file:
sudo nano /etc/ssh/sshd_configFind the line
Port 22, change22to a number between1024and65535, and remove the#. -
Configure Firewall Rules for the Custom SSH Port:
sudo ufw delete allow ssh sudo ufw allow <# from step 4>/tcp -
Restart the SSH Service:
sudo systemctl restart ssh -
Verify the Configuration:
sudo systemctl status ssh
You should now be able to SSH using openssh-server:
ssh -p <# from step 4> <username of account on device>@<ip of device>