Which THREE factors determine whether a local user can SSH into a Red Hat Enterprise Linux 9 system? (Choose three.)
Trap 1: The /etc/nologin file exists.
The mere existence of /etc/nologin blocks local console and terminal logins by displaying its contents to non-root users, but sshd does not consult this file. SSH access is governed by the SSH daemon's own configuration and PAM stack; unless pam_nologin is explicitly enabled for the sshd service, the file has no effect on incoming SSH connections. Therefore, /etc/nologin is irrelevant to whether a user can SSH.
Trap 2: The user has sudo privileges.
Having sudo privileges grants the user the ability to execute commands as another user (typically root) after logging in, but it is not an authentication mechanism for SSH. The SSH server validates credentials against account passwords or SSH keys; sudoers membership is never queried during the SSH handshake. Consequently, a user with sudo can still be unable to SSH if their account is locked or their shell is invalid, and an average user without sudo can SSH normally provided other conditions hold.
- A
The /etc/nologin file exists.
Why it fails: The mere existence of /etc/nologin blocks local console and terminal logins by displaying its contents to non-root users, but sshd does not consult this file. SSH access is governed by the SSH daemon's own configuration and PAM stack; unless pam_nologin is explicitly enabled for the sshd service, the file has no effect on incoming SSH connections. Therefore, /etc/nologin is irrelevant to whether a user can SSH.
- B
The user has sudo privileges.
Why it fails: Having sudo privileges grants the user the ability to execute commands as another user (typically root) after logging in, but it is not an authentication mechanism for SSH. The SSH server validates credentials against account passwords or SSH keys; sudoers membership is never queried during the SSH handshake. Consequently, a user with sudo can still be unable to SSH if their account is locked or their shell is invalid, and an average user without sudo can SSH normally provided other conditions hold.
- C
The user's shell is listed in /etc/shells.
sshd verifies that the user's login shell is listed in /etc/shells before permitting a session. If the shell field for the user points to /sbin/nologin, /bin/false, or any other program not present in /etc/shells, the daemon treats the account as non-login and rejects the SSH connection even when the password or key is correct. This is a deliberate account-restriction mechanism used to prevent interactive shell access.
- D
The user's ~/.ssh/authorized_keys file exists and has correct permissions.
For public key authentication, ~/.ssh/authorized_keys must contain the user's public key and must be owned by the user, with permissions that do not allow group or world write access (typically 600 for the file and 700 for ~/.ssh). If the file is missing, unreadable, or overly permissive, sshd refuses to accept the key, causing key-based login to fail. This factor is specifically required when PubkeyAuthentication is enabled and the user attempts to log in with a key.
- E
The /etc/ssh/sshd_config file allows password or key authentication.
The sshd_config file defines which authentication methods are allowed, such as PasswordAuthentication, PubkeyAuthentication, and KbdInteractiveAuthentication. If the configuration disables all permitted methods (e.g., PasswordAuthentication no and PubkeyAuthentication no), no user can establish an SSH session regardless of shell or key validity. Conversely, only methods explicitly enabled in this file will be available during the handshake, making it a mandatory prerequisite for SSH access.