Skip to content
  • Homepage
  • HTML
  • CSS
  • Symfony
  • PHP
  • How to
  • Contact
  • Donate

Teach Developer

Articles, Guides & Tips

How to Change SSH Port in Linux

Home  »  How to • Linux • SSH   »   How to Change SSH Port in Linux
Posted on September 9, 2022September 17, 2022
551

SSH (Secure Shell) is the most popular protocol for connecting remote Linux systems. Changing the SSH port will provide you with an extra layer of security. The new port will be a little harder to identify for hackers.

Change SSH Port in Linux

Changing the SSH port is a straightforward process in Linux systems. Any system can use the port range 1 to 65535, For TCP, port number 0 is reserved and cannot be used. The default SSH service listens on port 22. Just this port with some other ports.

To change the SSH port in Linux, edit the OpenSSH configuration file:

sudo nano /etc/ssh/sshd_config 
  • Change from – Search for the below line, default it can be commented.#Port 22
  • Change to – Remove the ‘#’ symbol from prefix to uncomment above the line, Then replace 22 with a non-standard port like Port 2232

To save and close a file press CTRL + X keys, then press ‘y’ and hit enter button.

Now, restart the SSH daemon to apply changes.

sudo systemctl restart ssh 

That’s it. The SSH service is now running on an updated port as configured above.

Connect SSH to New Port

The SSH service is listening on a non-standard port. So, you have to provide a port number while connecting the server using the ssh client.

Use the following command from the client machine to connect the remote server to a new port.

ssh -p 2232 user@remote-host

Conclusion

This tutorial helped you to secure your Linux server by changing the SSH port to a non-standard port. Once the SSH port is changed, you must update the firewall rules to secure the new port.

How to, Linux, SSH

Post navigation

Previous Post: How to Enable Debug Mode in Laravel
Next Post: How to Symfony Request

Related Posts

  • How to Deploy a React application on a cPanel
  • How to change password in the CodeIgniter framework
  • How to increase browser zoom level on page load with CSS?
  • How to Deploy or Host your ReactJS App in cPanel
  • How to use events listeners and Event Subscriber in Symfony
  • How to use :hover to modify the CSS of another class?

Categories

  • Codeigniter (3)
  • CSS (11)
  • eCommerce (1)
  • Framework (1)
  • Git (3)
  • How to (43)
  • HTML (5)
  • JavaScript (15)
  • Jquery (7)
  • Laravel (1)
  • Linux (4)
  • Magento-2 (1)
  • Node js (4)
  • Others (2)
  • PHP (11)
  • React (13)
  • Server (1)
  • SSH (3)
  • Symfony (6)
  • Tips (16)
  • Top Tutorials (10)
  • Ubuntu (3)
  • Vue (1)
  • Wordpress (7)

Latest Posts

  • What is SSH in Linux?
  • How to Delete Files in Ubuntu Command Line
  • How to Deploy a React application on a cPanel
  • How to use events listeners and Event Subscriber in Symfony
  • How to Convert PHP CSV to JSON

WEEKLY TAGS

AJAX (1) Codeigniter (1) Javascript (11) JQuery (1) PHP (16) Programming (1) React (3) Symfony (1)

Random Post

Difference Between Git and GitHub
How to change background Opacity when the bootstrap modal is open with CSS?
How to make a div always float on the screen in the top right corner with CSS?
How to display the last updated date of a post in WordPress
How to Make Toggles With React Hooks

Quick Navigation

  • About
  • Contact
  • Privacy Policy

© Teach Developer 2021. All rights reserved