Security

An administrator moves sshd on an Ubuntu server to listen on TCP port 2222. The firewall has the rule created earlier by running "sudo ufw allow ssh", and ufw is active with a default deny incoming policy. Remote clients now time out when they connect to port 2222. Which command BEST allows the connections?

Show the answer

Correct answerA. sudo ufw allow 2222/tcp

The service name "ssh" resolves to port 22/tcp, so the existing rule never covers the new port. Allowing 2222/tcp opens the port sshd actually uses. Limiting ssh is tempting, but it still resolves to port 22 and only adds rate limiting.