Dino Geek, try to help you

How to change the SSH port on a VPS server?


Before changing the SSH port on your server, ensure that you’re logged in as a user with sudo privileges or root user.

Here are the steps:

1. Open the SSHD configuration file:

`sudo nano /etc/ssh/sshd_config`

(Note: We’re using `nano` as the text editor in this example, but you can use the editor you’re comfortable with such as `vim` etc.)

1. Look for a line that says `Port 22`. If you can’t find it, you can add it at the top of the file. This represents the current port number.

1. Change `22` to your desired port number. Make sure you choose a port number that is not in use by any other service. For example:

`Port 2222`

No other service should be using this port, and it should be opened in your firewall.

1. Save and close the file. In `nano`, you can do this by pressing `ctrl+x`, then `y` to confirm that you want to save the changes, and then `Enter` to confirm the file name.

1. Then, restart the SSH service for the changes to take effect. The command to restart the service varies depending on your distribution:

- Ubuntu/Debian:

`sudo systemctl restart ssh`

- CentOS/Fedora:

`sudo systemctl restart sshd`

1. You should now test your new configuration by opening a new terminal window and try connecting using the new port number:

`ssh -p 2222 user@hostname`

Here `-p 2222` should be replaced by `-p your_new_port_number`.

Caution: Do not close the current SSH session until you have confirmed that the new settings work. If there’s a configuration error, and you’ve closed all sessions, you could potentially lock yourself out of the server.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use