setting a custom port for ssh on a virtual machine created/maintained by cloudmin

I was trying to set custom port for SSH on a vm. I set the port and restarted sshd with service restart sshd while I was logged into the VM via SSH.

Something went wrong and I am unable access the vm by its local ip, 192.168.1.223 via ssh.

The VM is a CentOs 7 guest on CentOS 7 host. Apache is running. I am able to access 192.168.1.223. But SSH is not.

So, my question is 'how do I force set ssh to a custom port on the vm'?

Status: 
Active

Comments

Ilia's picture
Submitted by Ilia on Sun, 02/02/2020 - 08:11

Something went wrong and I am unable access the vm by its local ip, 192.168.1.223 via ssh.

At first check if the new port that you are using for SSH now is allowed in FirewallD.

Moreover, now, when using ssh command to connect to your SSH server that runs on the custom port, you would need to use -p param to specify the custom port, like:

ssh -p 2222 user@192.168.1.223


If doesn't help - check for error messages returned, while connecting (like connection refused) or/and messages in /var/log/secure. You could also enable verbose logging while connecting by adding -v param to ssh command.

On the Cloudmin side, you can set a custom port for SSH at Change Password -> Change Login Used by Cloudmin

bislinks's picture
Submitted by bislinks on Mon, 02/03/2020 - 07:40

JamieCameron: I did but still same error:

No SSH (Last changed at 02/02/2020 11:01:01 PM) Detailed status error ssh: connect to host 192.168.1.223 port 7201: No route to host

Ilia's picture
Submitted by Ilia on Mon, 02/03/2020 - 07:45

Is the new port 7201 opened on firewall(s)?

bislinks's picture
Submitted by bislinks on Wed, 02/05/2020 - 08:21

cannot access the vm via ssh. so, no way of knowing if it is open.