You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

OCI: How To Change ssh Port Number in Ubuntu

edited Sep 30, 2024 2:22PM in Linux

Applies To:

Oracle Cloud Infrastructure

Ubuntu OS

Goal:

This document explains steps to change the ssh port number of an Ubuntu instance from Port 2222 to 22.

Solution:

  1. Login to the instance if possible via ssh.
  2. If ssh is not possible due to error “No route to host” , then follow the steps in this document to mount the boot volume on another working Instance.
  3. Once the boot volume is mounted on a working instance, perform the following below to change the port number:
    $ vi /etc/ssh/sshd_config
    Port 22
  4. Save the file and run the command below:
    $ sudo update-grub
  5. Exit from chroot

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!