I have been trying to use add ssh key to vagrant VMs through this command.
ssh-copy-id -f -i .vagrant/machines/workers/virtualbox/private_key -o PasswordAuthentication=no vagrant@192.168.5.30
The error is
/usr/bin/ssh-copy-id: ERROR: failed to open ID file .vagrant/machines/workers/virtualbox/private_key.pub'
The problem is I am assigning private_key
but it is keep asking for .pub
that doesn't exist. How can I force ssh to take private_key
?
Also I tried to rename private_key
to private_key.pub
and it returns
vagrant@192.168.5.30: Permission denied (publickey).
I just want to access to vagrant VM with command ssh vagrant@192.168.5.30
(without password) instead of vagrant ssh workers
*.pub
will not magically make it the publickey of the keypair. You may want to educate yourself and meet alice and bob before proceeding to setup technology that you do not understand yet. If you are missing the publickey, generate a new keypair withssh-keygen
.