1

I am trying to setup passwordless ssh to my localhost (itself).

I have host machine PM1 and then I lauch a VM(vm1) using qemu-kvm and logged into VM. Then, I am trying to setup passworless ssh within vm1, so that ssh root@vm1 (from vm1 itself) should log me in without password.

vm1# ssh-copy-id root@vm1

Then

vm1# ssh root@vm1

Now, I can login without password. no issues.

Then I started looking into authorized_keys. /root/.ssh/authorized_keys

Here I find a new entry like:

ssh-rsa <some key> <hostmachine username>@<hostmachine hostname>

how come hostmachine username and hostmachine hostname comes into picture here?? Should n't it be vm machine username @ vm machine hostname?

This looks bit weird.

3

The text after the key is just a comment. It is the comment that is added when the key is generated. You can change it to be whatever you want or even remove it. It is there because ssh-copy-id does exactly what it says and just copies the public key to the remote machine.

This is documented

Protocol 2 public key consist of: options, keytype, base64-encoded key, comment.

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.