When I set up SSH with authentication based keys I realized that the private key was needed for authentication to work But when I deleted the private key (ID_RSA) I can still log in without a password.

Here is the output of ssh -vvv https://pastebin.com/1fiLQrdZ

  • Offering RSA public key: /root/.ssh/id_rsa..not very sure. Seems it's there? – Sourav Ghosh Dec 18 '17 at 19:14
  • @SouravGhosh /root/.ssh/id_rsa its my private key. the public ends with .pub Even when i delete my private key, i still can connect to the server. What can be wrong? – Antonio Dec 18 '17 at 19:32
  • Are you trying to ssh to the other host as root? Or are you as your own user trying the ssh? You can also try to generate a new key ssh-keygen so they no longer match. – Terrance Dec 18 '17 at 19:42
  • @Terrance I really don't know why, but in ubuntu 16.04 if i delete the private key , it require password again. and in Kali linux , it justs connect automatic. – Antonio Dec 18 '17 at 19:44
  • debug2: key: /root/.ssh/id_rsa (0x562f13324250), agent Do you have ssh agent that may happen to cache keys? – vidarlo Dec 18 '17 at 19:59

After you delete your private key, you can still login without password if you use a key manager that has your private key cached.

After the key manager is stopped, you will not be able to login with your nonexistent key. (For example after you logout and login again.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.