RHCSA RHCSA SSH and Remote Access Configuration 1 — Questions and Answers
Question 1: Which file contains the system-wide SSH server configuration on RHEL?
- /etc/ssh/sshd_config (Correct answer)
- /etc/ssh/ssh_config
- /etc/sshd.conf
- /etc/openssh/sshd_config
Correct answer: /etc/ssh/sshd_config
The SSH daemon reads its server-side configuration from `/etc/ssh/sshd_config` on RHEL and most Linux distributions.
Question 2: What command generates an SSH key pair for key-based authentication?
- ssh-keygen (Correct answer)
- ssh-copy-id
- ssh-add
- ssh-agent
Correct answer: ssh-keygen
`ssh-keygen` generates a new public/private SSH key pair, defaulting to `~/.ssh/id_rsa` and `~/.ssh/id_rsa.pub`.
Question 3: Which command copies your public SSH key to a remote host for passwordless login?
- ssh-copy-id user@host (Correct answer)
- scp ~/.ssh/id_rsa.pub user@host
- ssh-add user@host
- ssh-keygen -c user@host
Correct answer: ssh-copy-id user@host
`ssh-copy-id` appends your public key to the remote user's `~/.ssh/authorized_keys` file automatically.
Question 4: Where is the authorized public keys file stored for SSH key-based login on RHEL?
- ~/.ssh/authorized_keys (Correct answer)
- ~/.ssh/known_hosts
- /etc/ssh/authorized_keys
- ~/.ssh/id_rsa.pub
Correct answer: ~/.ssh/authorized_keys
The SSH daemon checks `~/.ssh/authorized_keys` in the target user's home directory for permitted public keys.
Question 5: Which `sshd_config` directive disables root login over SSH?
- PermitRootLogin no (Correct answer)
- AllowRoot no
- RootLogin disabled
- DenyRoot yes
Correct answer: PermitRootLogin no
Setting `PermitRootLogin no` in `/etc/ssh/sshd_config` prevents the root account from authenticating via SSH.
Question 6: After editing `/etc/ssh/sshd_config`, what command applies the changes?
- systemctl restart sshd (Correct answer)
- service ssh reload
- sshd -t
- pkill -HUP sshd
Correct answer: systemctl restart sshd
You must restart the `sshd` service with `systemctl restart sshd` to apply any configuration file changes.
Which file contains the system-wide SSH server configuration on RHEL?