ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 86 - XK0-005 discussion

Report
Export

An administrator transferred a key for SSH authentication to a home directory on a remote server.

The key file was moved to .ssh/authorized_keys location in order to establish SSH connection without a password. However, the SSH command still asked for the password. Given the following output:

Which of the following commands would resolve the issue?

A.
restorecon .ssh/authorized_keys
Answers
A.
restorecon .ssh/authorized_keys
B.
ssh_keygen -t rsa -o .ssh/authorized_keys
Answers
B.
ssh_keygen -t rsa -o .ssh/authorized_keys
C.
chown root:root .ssh/authorized_keys
Answers
C.
chown root:root .ssh/authorized_keys
D.
chmod 600 .ssh/authorized_keys
Answers
D.
chmod 600 .ssh/authorized_keys
Suggested answer: D

Explanation:

The command that would resolve the issue is chmod 600 .ssh/authorized_keys. This command will change the permissions of the .ssh/authorized_keys file to 600, which means that only the owner of the file can read and write it. This is necessary for SSH key authentication to work properly, as SSH will refuse to use a key file that is accessible by other users or groups for security reasons. The output of ls -l shows that currently the .ssh/authorized_keys file has permissions of 664, which means that both the owner and group can read and write it, and others can read it.

The other options are not correct commands for resolving the issue. The restorecon .ssh/authorized_keys command will restore the default SELinux security context for the .ssh/authorized_keys file, but this will not change its permissions or ownership. The ssh_keygen -t rsa -o .ssh/authorized_keys command is invalid because ssh_keygen is not a valid command (the correct command is ssh-keygen), and the -o option is used to specify a new output format for the key file, not the output file name. The chown root:root .ssh/authorized_keys command will change the owner and group of the .ssh/authorized_keys file to root, but this will not change its permissions or make it accessible by the user who wants to log in with SSH key authentication. Reference: How to Use Public Key Authentication with SSH; chmod(1) - Linux manual page

asked 02/10/2024
Musaddiq Shorunke
44 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first