Hello
The task is:
The student user on the serverb machine must be able to log in to the servera machine by using the review3_key.pub SSH key.
But after
ssh-copy-id -i .ssh/review3_key.pub student@servera
when logging in to servera I m still prompted for a password.
The lab shows as PASS and not fail, but I dont understand why it's asking for a password when the keys have been successfully copied over.
Hi!
One possible reason - wrong permissions of .ssh directory in users's profile in servera., i.e /home/user/.ssh
If permissions are not 700, the ssh server will drop your connecitons nevertheless you copied successfully the pub part of pair.
Do you have access to servera?
Also, have a look on pub file authorized_keys inside .ssh folder. I thinnk should not be world readable, i.e - have to be with mode 640
@87951469 Which chapter /section is this lab in RH124 ? Is it from v9.3 course ?
Please check and set the PasswordAuthentication parameter to no in the /etc/ssh/sshd_config file and reload the sshd service.
PasswordAuthentication no
Then it will allow users to authenticate with SSH keys only, rather than with their passwords.
The reason is you aren't giving it the "private" key when you are attempting to SSH. By default, SSH is configured to use id_rsa and id_rsa.pub for the public/private key pair. Your .ssh/config file is setup to use SSH keys on workstation and that is what allows lab scripts to work and generally prevents you from SSHing needing a password because the keys are setup.
So just like you specified the "-i <key_name>" you will need to provide the private key with the SSH command. You did a plain SSH without specifying a private key to use so it couldn't match the private key with the public key you copied to serverA.
You have two choices here ...
ssh -i .ssh/review3_key servera
Oh ... the reason you likely get a "PASS" is because the grading script is specifically providing the private key as part of the SSH checks which you didn't do in the SSH command you had.
While some of the other items are general troubleshooting points in terms of permissions on keys and how SSH is configured, that is not what is preventing your command from succeeding. The main issue is you aren't giving it the private key that corresponds to the public key you transferred.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.