---
title: "How to Update SSH Port"
date: 2024-11-04T12:00:00.000Z
author: Z.SHINCHVEN
tags: [ssh, linux, security, port]
canonical: https://atlassc.net/2024/11/05/how-to-update-ssh-port
---
When you want to change the default SSH port, you need to edit the SSH configuration file and then restart the SSH service.

First, open the SSH configuration file `/etc/ssh/sshd_config` with your favorite editor. For example:

```bash
sudo nano /etc/ssh/sshd_config
```

Find the line `#Port 22` and change it to your desired port number. For example, to change the port to 2222, you would change the line to:

```
Port 2222
```

After saving the file, you need to restart the SSH service for the changes to take effect. On modern Linux distributions that use systemd, you can use the following commands:

```bash
sudo systemctl daemon-reload
sudo systemctl restart ssh.socket
```

This will apply the new SSH port configuration.
