Ssh Server Setup for Local Wifi Access
Here's how to set up an SSH server on Linux to allow connections from your local WiFi network:
Install SSH Server
Ubuntu/Debian:
sudo apt update
sudo apt install openssh-server
CentOS/RHEL/Fedora:
sudo yum install openssh-server # CentOS/RHEL
sudo dnf install openssh-server # Fedora
Start and Enable SSH Service
sudo systemctl start ssh # Ubuntu/Debian
sudo systemctl start sshd # CentOS/RHEL/Fedora
sudo systemctl enable ssh # Ubuntu/Debian
sudo systemctl enable sshd # CentOS/RHEL/Fedora
Configure SSH (Optional but Recommended)
Edit the SSH configuration file:
sudo nano /etc/ssh/sshd_config
Key settings to consider:
Port 22
(default, or change for security)PasswordAuthentication yes
(allow password login)PubkeyAuthentication yes
(allow key-based login)PermitRootLogin no
(disable root login for security)
After making changes, restart SSH:
sudo systemctl restart ssh # Ubuntu/Debian
sudo systemctl restart sshd # CentOS/RHEL/Fedora
Configure Firewall
Ubuntu (UFW):
sudo ufw allow ssh
sudo ufw enable
CentOS/RHEL/Fedora (firewalld):
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
Find Your Server's IP Address
ip addr show
# or
hostname -I
Connect from Another Device
From any device on the same WiFi network:
ssh username@server-ip-address
For example:
ssh john@192.168.1.100
Test the Connection
Check if SSH is listening:
sudo netstat -tlnp | grep :22
The SSH server should now be accessible from any device connected to your local WiFi network using the server's local IP address.