Steps to set up SSH on Ubuntu 22:
๐ ๏ธ Step 1: Prepare Your System
Before installing SSH, ensure your system is up-to-date:
sudo apt update && sudo apt upgrade
๐ Step 2: Install OpenSSH Server
To install the OpenSSH server package:
sudo apt install openssh-server
๐ Step 3: Start and Enable SSH Service
Enable and start the SSH service:
sudo systemctl enable --now ssh
Verify that the SSH service is running:
sudo systemctl status ssh
๐ฅ Step 4: Configure the Firewall
If you're using UFW (Uncomplicated Firewall), allow SSH connections:
sudo ufw allow ssh
Check the status of UFW to ensure SSH is allowed:
sudo ufw status
๐ Step 5: Connect to the Server
To connect to your server via SSH, use the following command:
ssh username@server_ip
Replace username with your actual username and server_ip with your server's IP address.
โ๏ธ Optional: Configure SSH for Enhanced Security
To enhance security, consider editing the SSH configuration file:
sudo nano /etc/ssh/sshd_config
Some recommended changes:
โข Disable root login:
โข PermitRootLogin no
โข Change the default port (e.g., to 2222):
Port 2222
After making changes, restart the SSH service:
sudo systemctl restart ssh
Top comments (0)