Brief
Allow the following TCP port numbers on SSH server
22
2222
Premises
- The machine uses an Amazon Linux AMI distribution
- The SSH installation is based on an SELinux system
Details
By default, SSH uses TCP port 22
. Is it possible to allow the SSH server to accept inbound traffic from TCP port 2222
? If so... How?
I looked at the SSH's config file...
/etc/ssh/sshd_config
...
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
...
It tells that I should use semanage
to configure this section instead of overwriting the said file.
How to use semanage
to allow the SSH server to accept inbound traffic from 2 TCP port numbers mentioned above? Also both at the same time.