How to change the SSH port for single partition KVM templates from SolusVM TDN repository?

Applicable to:

  • SolusVM

Question

How to change the SSH port for single partition KVM templates from SolusVM TDN repository?

Answer

Note: Steps below describe SSH port for the single partition template on the SolusVM Master node. To apply the changes for the templates on the slave nodes, it is required to synchronize them the slave nodes.

In the following example we are going to change sshd_config for Ubuntu 16.04 template file:

  1. Connect to the SolusVM Master server via SSH
  2. Create a temporary directory for mount point:

    # mkdir /mnt_tmp

  3. Mount a single-partition template image on this mount point, in this example it is Ubuntu 16 x64 single partition template:

    # guestmount -a /home/solusvm/kvm/template/linux-ubuntu-16.04-x86_64-minimal-latest.gz -i --rw /mnt_tmp

  4. sshd_config file is located in the following directory /mnt_tmp/etc/ssh/

    # ls -l /mnt_tmp/etc/ssh/sshd_config
    -rw------- 1 root root 4161 May 7 2018 /mnt_tmp/etc/ssh/sshd_config

  5. Open this file in the text editor like vi and update the SSH port, change the value for Port to your desired value.

  6. # vi  /mnt_tmp/etc/ssh/sshd_config

    Before

    #Port 22

    After

    Port 2220

    SSH port is changed from defalt value 22 to 2220 on the template.

  7. Unmount the image:

    # fusermount -u /mnt_tmp/

  8. Do not forget to synchronize the template with slave KVM nodes

 Once the changes are applied, SSH port of the new VPS created using the template will have a custom SSH port 2220.

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.