Lab - SSL & TLS Basics Q 8 Error

hi @KodeKloud / @vijin.palazhi / @mmumshad

In Lab SSL & TLS Basics Q8 there is requirement to copy the public key so that ssh woudl be password less . I have two questions here

  1. Even though the commands in the hints work I still get a error / warning although the ssh is succeful . Why do I get this error ?

thor@jump_host /$ ssh -i mykey thor@app01
Warning: Identity file mykey not accessible: No such file or directory.


Q2 : How can we verify the login using only mykey and not by existing keys id_rsa and id_rsa.pub
In default way of login I do not get this warning / error . 

It appears to me default login to app01 from thor is using id_rsa and there is no error / warning like in Q1

thor@jump_host / date Thu Jan 28 17:13:17 UTC 2021 thor@jump_host /
thor@jump_host / thor@jump_host / ssh app01
Last login: Thu Jan 28 17:12:10 2021 from jump_host.devops-security-ssl_app_net
[thor@app01 ~] [thor@app01 ~]
[thor@app01 ~] date Thu Jan 28 17:20:48 UTC 2021 [thor@app01 ~]
[thor@app01 ~]$

thor@jump_host / ls -al ~/.ssh/ total 32 drwxr-xr-x 1 thor thor 4096 Jan 28 17:06 . drwx------ 1 thor thor 4096 Mar 29 2020 .. -r-------- 6 thor thor 1679 Mar 29 2020 id_rsa -rw-r--r-- 6 thor thor 382 Mar 29 2020 id_rsa.pub -rw-r--r-- 1 thor thor 181 Jan 28 16:54 known_hosts -rw------- 1 thor thor 1679 Jan 28 16:49 mykey -rw-r--r-- 1 thor thor 420 Jan 28 16:49 mykey.pub thor@jump_host /
thor@jump_host / thor@jump_host /
thor@jump_host / ssh -i mykey thor@app01 Warning: Identity file mykey not accessible: No such file or directory. Last login: Thu Jan 28 17:10:54 2021 from jump_host.devops-security-ssl_app_net [thor@app01 ~]
[thor@app01 ~] [thor@app01 ~] cat ~/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFpUwGN8rN9W4ps01Jxfw/yNjEMOOLw/TGa1uzfpM7ukk8SePN5Hnp5+2UY5XlFVBhz7HNqvhQ42B/wNZxQvUvqEtYZQ7vkyYvwTfiySB4vKXCGt0HnstzxHvIQ/35DTvkxBogKJrx873Si28XaLKPT2swJFk5Mf5CuGxXiggDIInS3FsWTK0x3HS/zq5isWv0U/trYU7aW35uGFTnLrBuOquRjpFpwkB/yPbxAUrrE9kqodd8KkaoWUW0pWy0TlxX26WtVeYOrDi0nKQxkwaoh7X9fv0y1tooTmmHjchKbrpotRGuIrfzWpbr+BAaEprfaQKFu0mlMTOur3XV+PKf

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9Ohm5n2zHuKzFnef1HmIO766U7h9pm69AxzJnwwyoUJ5orAkNURLyz7NoUqvKg3zR1e/2cEVqH/3OkgzKMKxsigfp2OHLZZ34H2qE9BaTz6q5jRQVPwYjnd1FmZt+Ej0oHpyN0gOX9kJeGPd9sfta1H+uKbCdO2PP8QnESJeGG7IbgWAjc86qNuF01scSEnjJNTNhLYD/22WRVT2HBASH0BB9lVLFAYV2lw4xFWe6LDNTMKwEV0cqK7o4tIMZbVOp6kLA2pkWPAfG8XZDgUYvkFHDVfh8fikFW+ExtRwqvkqz+J9cyq/di/1eqJLexW1ftJkePtu3Co4fiK9gvSIZ thor@jump_host.stratos.xfusioncorp.com
[thor@app01 ~] [thor@app01 ~] date
Thu Jan 28 17:12:42 UTC 2021
[thor@app01 ~] [thor@app01 ~] exit
logout
Connection to app01 closed.
thor@jump_host / thor@jump_host /
thor@jump_host / cat ~/.ssh/mykey.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9Ohm5n2zHuKzFnef1HmIO766U7h9pm69AxzJnwwyoUJ5orAkNURLyz7NoUqvKg3zR1e/2cEVqH/3OkgzKMKxsigfp2OHLZZ34H2qE9BaTz6q5jRQVPwYjnd1FmZt+Ej0oHpyN0gOX9kJeGPd9sfta1H+uKbCdO2PP8QnESJeGG7IbgWAjc86qNuF01scSEnjJNTNhLYD/22WRVT2HBASH0BB9lVLFAYV2lw4xFWe6LDNTMKwEV0cqK7o4tIMZbVOp6kLA2pkWPAfG8XZDgUYvkFHDVfh8fikFW+ExtRwqvkqz+J9cyq/di/1eqJLexW1ftJkePtu3Co4fiK9gvSIZ thor@jump_host.stratos.xfusioncorp.com thor@jump_host /
thor@jump_host / date Thu Jan 28 17:13:17 UTC 2021 thor@jump_host /

===================================================================

thor@jump_host / date Thu Jan 28 17:13:17 UTC 2021 thor@jump_host /
thor@jump_host / thor@jump_host / ssh app01
Last login: Thu Jan 28 17:12:10 2021 from jump_host.devops-security-ssl_app_net
[thor@app01 ~] [thor@app01 ~]
[thor@app01 ~] date Thu Jan 28 17:20:48 UTC 2021 [thor@app01 ~]
[thor@app01 ~]$

Please try again with sudo