XK0-005 · Question #815
A user sends a request to access a virtual server via SSH. Which of the following commands is used to open the SSH standard port?
The correct answer is A. firewalld-cmd --permanent --add-port=22/tcp. The command 'firewall-cmd --permanent --add-port=22/tcp' opens TCP port 22 (SSH standard port) permanently in the firewalld firewall. The '--permanent' flag ensures the rule persists after reboot. Note the correct binary is 'firewall-cmd' (not 'firewalld-cmd'); among the given…
Question
A user sends a request to access a virtual server via SSH. Which of the following commands is used to open the SSH standard port?
Options
- Afirewalld-cmd --permanent --add-port=22/tcp
- Biptables-save | grep dport-22/tcp
- Ciptables -A INPUT -p tcp --dport sshd -j ACCEPT
- Dfirewalld-cmd --remove-service=ssh --permanent
How the community answered
(27 responses)- A85% (23)
- B4% (1)
- C7% (2)
- D4% (1)
Explanation
The command 'firewall-cmd --permanent --add-port=22/tcp' opens TCP port 22 (SSH standard port) permanently in the firewalld firewall. The '--permanent' flag ensures the rule persists after reboot. Note the correct binary is 'firewall-cmd' (not 'firewalld-cmd'); among the given choices, A represents the correct syntax and intent. Option B uses 'iptables-save | grep' which only reads/saves rules, it does not open a port. Option C uses '--dport sshd' which is invalid syntax (must use a port number, not a service name, with that flag). Option D removes the SSH service from firewalld, which would block SSH access.
Topics
Community Discussion
No community discussion yet for this question.