RHCSA RHCSA SSH and Remote Access Configuration 2 — Questions and Answers
Question 1: Which SSH option allows you to log in as a specific user to a remote host?
- ssh -l username host (Correct answer)
- ssh --user=username host
- ssh -u username host
- ssh -id username host
Correct answer: ssh -l username host
The `-l` flag specifies the remote login name; alternatively, `ssh username@host` achieves the same result.
Question 2: What `sshd_config` setting limits SSH access to only specific users?
- AllowUsers (Correct answer)
- PermitUsers
- UserWhitelist
- AllowLogin
Correct answer: AllowUsers
`AllowUsers` in `sshd_config` accepts a space-separated list of usernames permitted to log in via SSH.
Question 3: Which port does SSH use by default?
- 22 (Correct answer)
- 23
- 21
- 2222
Correct answer: 22
SSH operates on TCP port 22 by default, though this can be changed in `sshd_config` for security.
Question 4: What directive in `sshd_config` enables or disables password authentication?
- PasswordAuthentication (Correct answer)
- AuthMethod
- UsePassword
- LoginMethod
Correct answer: PasswordAuthentication
`PasswordAuthentication yes|no` controls whether users can authenticate using a password instead of a key.
Question 5: Which file on RHEL must be updated to allow the new SSH port through the SELinux policy?
- semanage port -a -t ssh_port_t -p tcp NEWPORT (Correct answer)
- /etc/selinux/ssh_ports
- /etc/ssh/selinux.conf
- setsebool -P ssh_port NEWPORT
Correct answer: semanage port -a -t ssh_port_t -p tcp NEWPORT
You use `semanage port -a -t ssh_port_t -p tcp <port>` to add the new port to the SELinux SSH port type policy.
Question 6: What command verifies the syntax of the SSH server configuration file without restarting the service?
- sshd -t (Correct answer)
- sshd --check
- sshdconfig -v
- systemctl verify sshd
Correct answer: sshd -t
`sshd -t` parses the configuration file and reports syntax errors without starting or restarting the daemon.
Which SSH option allows you to log in as a specific user to a remote host?