You aim to disable password-based authentication in SSH and only allow key-based authentication for added security. What configuration change is needed in the SSH server configuration file?1.0 Marks. Set KeyAuthentication only in /etc/ssh/sshd_configSet PasswordAuthentication no in /etc/ssh/sshd_configSet UsePAM no in /etc/ssh/sshd_config
Question
You aim to disable password-based authentication in SSH and only allow key-based authentication for added security. What configuration change is needed in the SSH server configuration file?1.0 Marks. Set KeyAuthentication only in /etc/ssh/sshd_configSet PasswordAuthentication no in /etc/ssh/sshd_configSet UsePAM no in /etc/ssh/sshd_config
Solution
To disable password-based authentication in SSH and only allow key-based authentication for added security, you need to make the following changes in the SSH server configuration file:
- Open the SSH daemon configuration file by typing the following command in the terminal:
sudo nano /etc/ssh/sshd_config
-
Find the line that includes
PasswordAuthentication. You can do this by using the search function in the nano editor, which is accessed by pressingCtrl+W. -
Once you've found the line, change its value to
no. If the line is commented out (i.e., if it starts with a#), you'll need to uncomment it by deleting the#. The line should look like this:
PasswordAuthentication no
- Similarly, find the line that includes
UsePAMand change its value tono. The line should look like this:
UsePAM no
-
After making these changes, save and close the file by pressing
Ctrl+X, thenY, thenEnter. -
Finally, restart the SSH service for the changes to take effect. You can do this by typing the following command in the terminal:
sudo systemctl restart ssh
Please note that you should already have set up key-based authentication before disabling password authentication, otherwise you may lock yourself out of the server.
Similar Questions
Which of the following commands can be used to disable password-based authentication for an OpenSSH server on a Linux system, forcing all users to authenticate using an SSH key?Question 9Answera.sed -i 's/PasswordAuthentication yes/#PasswordAuthentication no/' /etc/ssh/sshd_configb.sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_configc.sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_configd.sed -i 's/PasswordAuthentication no/#PasswordAuthentication yes/' /etc/ssh/sshd_config
Please choose an appropriate answer.When hardening your SSH server, how can you disable root login?Set NoRootUser to yesSet PermitRootLogin to noSet PasswordAuthentication to noSet MaxAuthTries to 1
An administrator defined a local user account with a secret password on router R1 for use with SSH. Which three additional steps are required to configure R1 to accept only encrypted SSH connections?
Please choose the best answer from the choices belowWhile operating a Linux host in the cloud, what should you enable to add another layer of security when accessing a host?2FAstrong passwordsDisable root loginPublic key pairs
The ssh command option -p is used to specify __________.1 pointThe username for the remote serverThe path to the private key file to use for authenticationThe password for the SSH connectionThe port number to use for the SSH connection
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.