How to change the SSH port for single partition KVM templates from SolusVM TDN repository?
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:
- Connect to the SolusVM Master server via SSH
- Create a temporary directory for mount point:
# mkdir /mnt_tmp
- 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
- 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
Open this file in the text editor like vi and update the SSH port, change the value for Port to your desired value.
# vi /mnt_tmp/etc/ssh/sshd_config
SSH port is changed from defalt value 22 to 2220 on the template.
- Unmount the image:
# fusermount -u /mnt_tmp/
- 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.