Vultr DocsLatest Content

Associated Doc

How Do I Change My Vultr Compute Instance’s SSH Port?

Updated on 15 September, 2025

A guide for modifying the default SSH port on Vultr Compute instances to improve security against automated attacks


Changing the default SSH port (22) enhances security by reducing automated attacks. Follow the steps below to safely change the SSH port on your Vultr Compute instance:

  1. SSH into your Vultr instance.

  2. Open the SSH daemon config file.

    console
    $ sudo nano /etc/ssh/sshd_config
    

    Locate the following line:

    #Port 22

    Uncomment it and replace 22 with your desired port number (e.g., 2222):

    ini
    Port 2222
    

    Use a port between 1024 and 60000 to avoid conflicts.

  3. Allow the new port in the firewall.

    console
    $ sudo ufw allow 2222/tcp
    
  4. Restart the SSH service to apply the changes.

    console
    $ sudo systemctl restart sshd
    
  5. To SSH into your instance now you have to define the port as well.

    console
    $ ssh username@your_instance_ip -p 2222
    

    Once verified, you can optionally remove access to port 22:

    console
    $ sudo ufw delete allow 22/tcp
    

The above steps are demonstrated on an Ubuntu instance. If you're using a different Linux distribution (like CentOS, AlmaLinux, or FreeBSD), refer to your system's specific documentation.