Change the default SSH port

We currently deploy our EC2 hosts on RancherOS via Rancher.

Some of our services run on port 22 (git server for example) which means we have no way to SSH into the host without stopping the git service.

Is there anyway we can control the SSH port and still use Rancher to launch the host? If not, is this something we can do after the host has booted (i.e. modify a configuration file somewhere).


I imagine you can do sed replace on the sshd config in the startup script, but changing it is not going to play well with docker-machine (which Add Host in Rancher uses)… 22 is hardcoded in the driver.

1 Like

Can we modify the ssh config post deploy without causing problems (bearing
in mind that 22 on the host is taken over by git anyway)?

If so, what is the correct ssh config file on RancherOS?

Standard /etc/ssh/sshd_config

Thanks although the sshd_config file seems to get reverted after a reboot. How can we persist the change?