Change Default SSH Port in Ubuntu

By default SSH Port uses port number 22. But if you want to change the default SSH port in Ubuntu, perform the following steps with root privileges:

  1. Open the /etc/ssh/sshd_config file and locate the line #Port 22
sudo nano /etc/ssh/sshd_config

2. Then, uncomment (Remove the leading # character) it and change the value with an appropriate port number (for example, 4022) then save the configuration

3. Restart service SSH

systemctl restart sshd

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.