Skip to main content

Change SSH Port

Changing the SSH port reduces brute-force attacks by making it harder for attackers to find.

1. Edit SSH Configuration

sudo nano /etc/ssh/sshd_config

Modify:

#Port 22
Port 2222

2. Apply Changes

sudo systemctl restart ssh
sudo ufw allow 2222/tcp
sudo ufw delete allow 22/tcp

3. Test the New User Login (Port 2222)

ssh -p 2222 youruser@your_vps_ip
sudo ls /root

Now, SSH runs on a custom port.

© 2025 TokioStack. All rights reserved.
DMCA.com Protection Status