ns8:admin_cmds:ssh

SSH redirects is incorporated in the official Nethserver 8 documentation.

SSH

For EL systems this is a brief procedure (tested on Rocky Linux 9) that opens port 2222 and restricts port 22 to trusted interfaces.

firewall-cmd --permanent --add-forward-port=port=2222:proto=tcp:toport=22
firewall-cmd --permanent --service=ssh --add-port=2222/tcp
firewall-cmd --permanent --service=ssh --remove-port=22/tcp
firewall-cmd --reload

To change it to another port e.g. from above TCP port 2222 to TCP port 2019

 firewall-cmd --permanent --add-forward-port=port=2019:proto=tcp:toport=22
 firewall-cmd --permanent --service=ssh --add-port=2019/tcp
 firewall-cmd --permanent --remove-forward-port=port=2222:proto=tcp:toport=22
 firewall-cmd --permanent --service=ssh --remove-port=2222/tcp
 firewall-cmd --reload

To reset to default from the above example TCP port 2019 to TCP port 22:

firewall-cmd --permanent --remove-forward-port=port=2019:proto=tcp:toport=22
firewall-cmd --permanent --service=ssh --remove-port=2019/tcp
firewall-cmd --permanent --service=ssh --add-port=22/tcp
firewall-cmd --reload
 

Back to Admin commands


  • ns8/admin_cmds/ssh.txt
  • Last modified: 8 months ago
  • by LayLow