Skip to content
English
  • There are no suggestions because the search field is empty.

How to change the SSH port (Linux - Ubuntu)

PublicUse-4

 

UbuntuSSHSub1

  1. Once logged in type:
    sudo -i

    UbuntuSSH1
  2. Enter the account password to enter sudo edit mode.

 

UbuntuSSHSub2

  1. Once in sudo edit mode enter the command:
    vi /etc/ssh/sshd_config

    UbuntuSSH2
  2. Type /Port22 to highlight Port 22 and then delete the "#" to uncomment it.
  3. Change the port to the new port number.

    UbuntuSSH3
  4. Use "Ctrl+x" to save.
  5. Once out of sudo edit mode enter the command:
    systemctl restart ssh.service

    UbuntuSSH4

  6. Disconnect from the server.

 

UbuntuSSHSub3

  1. On your desktop open CMD or Putty and enter the following command:
    ssh -p <new port> userid@ipaddress

UbuntuSSH5

 

FurtherIssues-Mar-06-2025-01-32-53-6320-PM