You must open SSH on a non-standard port 2222 on a RHEL server with SELinux enforcing. What steps are needed?
IntermediateScenarioNetworking, SSH and remote access
Answer
Situation read → sshd config, SELinux port label and firewall all need changing.
What I'd do →
sudo semanage port -a -t ssh_port_t -p tcp 2222
echo 'Port 2222' | sudo tee /etc/ssh/sshd_config.d/20-port.conf
sudo firewall-cmd --permanent --add-port=2222/tcp && sudo firewall-cmd --reload
sudo sshd -t && sudo systemctl restart sshd
ss -tlnp | grep 2222
Why → SELinux only lets sshd bind to ports labelled ssh_port_t; without it, sshd fails to start.
Interview tip → Say a non-standard port reduces log noise but isn't real security.
More on Networking, SSH and remote access
A key belonging to a departed engineer may be in `authorized_keys` on 300 servers. How do you rotate SSH keys across the fleet?IntermediateYou need to reach a database on a private subnet from your laptop through a bastion. How?BeginnerYour security team wants SSH hardened on all servers. What changes do you make?BeginnerA new server needs a static IP, gateway and DNS on RHEL 9. How do you configure it persistently?BeginnerYou're changing the network config of a remote server over SSH and could lose access. How do you protect yourself?IntermediateA web server should accept HTTP/HTTPS from anywhere but SSH only from the office. Configure the firewall.Beginner