Change sshd listen ip / port?

I would use the port 22/tcp for another service instead blocked by RancherOS. What is the simplest way to change the RancherOS sshd listen port or just use ONE defined ip address instead.

What’s the best way to do this with RancherOS 0.4.5?

1 Like

Hi
Someone help you to do this ? many thanks cause i have the same question

1 Like

bump - also very interested in this. I do not want to let the ssh port be accessible in WAN. Any chance in doing so? looked at
system-docker inspect console but no port is exposed here

Change the default sshd port there is a solution here

experimenting with the linked solution, even though https://github.com/rancher/os-images/pull/36 has been merged, adding

write_files:
- content: "Port 2222\nAuthorizedKeysFile\t.ssh/authorized_keys\nUsePrivilegeSeparation
    sandbox\t\t# Default for new installations.\nClientAliveInterval 180\nSubsystem\tsftp\t/usr/libexec/sftp-server\nUseDNS
    no\nPermitRootLogin no\nAllowGroups docker\n"
  owner: root:root
  path: /etc/ssh/sshd_config
  permissions: 384

does not work yet. Any hints?

This is the snipper that was posted, including the quotes on permissions in the last post. Does this not work in 1.0.1?

write_files:
- path: /etc/ssh/sshd_config
  permissions: "0600"
  owner: root:root
  content: |
     Port 2222
     AuthorizedKeysFile	.ssh/authorized_keys
     UsePrivilegeSeparation sandbox		# Default for new installations.
     ClientAliveInterval 180
     Subsystem	sftp	/usr/libexec/sftp-server
     UseDNS no
     PermitRootLogin no
     AllowGroups docker