Hi there, Vagrant boxes are usually packaged with a default "insecure" keypair ( https://github.com/hashicorp/vagrant/tree/master/keys) so that Vagrant can SSH in on first boot. Vagrant will then generate a unique keypair and replace the public key in authorized_keys.
Hope this helps! Jeff On Wed, Jun 10, 2020 at 6:28 AM Makrand <makrandsa...@gmail.com> wrote: > Hi, > > As stated in 1st post....I already know its using private key under > .vagrant DIR. > > >> /home/makrand/vagrant_ssd/devops-vm1/.vagrant/machines/devops-vm1/virtualbox/private_key > > > My question is - If I go to VM created with vagrant, I see public key in > /home/vagrant/.ssh/authorized_keys > > vagrant@devops-vm1:~$ cat .ssh/authorized_keys > ssh-rsa > AAAAB3NzaC1yc2EAAAADAQABAAABAQDF5o67xfl3llu/+lJK3X4Jn7E0BuVWDxxWjHaaWcUXguz8JeuIdZp0HEhv/5RS39v126YWnCCuUvzbrqMSl7/oG3l9IouyqCpSEmKDP32+FzEtPkMJqUi0KoQ6Jc1DurvOwexTeYNkxzOrREyxxNGjrFDnW5MQMIXaDHaRMRHTYT12dIlKNb0ptdszgdC4svmeFomNcfLsO/AwODIYk4FXjN4fLHwPBBJ3vAaeDnPlIf0OOFhE/JEQ7h4mYbZlySRZQYCN/QXvdMY7rkYw78lb0SQF+mtbVL3s3hJvfN0Xig+vj859inL/nQwmQ/Ye+2nv5wodfpivx7z/2frpojH3 > vagrant > > how is this public key generated? I've checked few VMs and in each there > is different public key authorized_keys. > > > On Monday, June 8, 2020 at 9:49:42 PM UTC+5:30, Alvaro Miranda Aguilera > wrote: >> >> hello >> >> you can use vagrant ssh-config to see the keys that can be used to login >> >> hope this helps >> >> alvaro >> >> On Mon, Jun 8, 2020 at 8:12 AM Makrand <makran...@gmail.com> wrote: >> >>> Hello All, >>> >>> Where excatly is public key (which is stored in authorized key under >>> .ssh in vagrant launched VM) for vagrant user is stored on the localhost? >>> >>> I can see below for an example VM >>> >>> >>> makrand@mint-gl63:~/vagrant_ssd/ubuntu18/.vagrant/machines/ubuntu-rke/virtualbox$ >>> pwd >>> >>> /home/makrand/vagrant_ssd/ubuntu18/.vagrant/machines/ubuntu-rke/virtualbox >>> makrand@mint-gl63:~/vagrant_ssd/ubuntu18/.vagrant/machines/ubuntu-rke/virtualbox$ >>> ls -l >>> total 76 >>> -rw-rw-r-- 1 makrand makrand 40 Jun 7 16:05 action_provision >>> -rw-rw-r-- 1 makrand makrand 10 Jun 8 11:19 action_set_name >>> -rw-rw-r-- 1 makrand makrand 148 Jun 8 11:19 box_meta >>> -rw-rw-r-- 1 makrand makrand 4 Jun 7 16:04 creator_uid >>> -rw-rw-r-- 1 makrand makrand 36 Jun 7 16:04 id >>> -rw-rw-r-- 1 makrand makrand 32 Jun 7 16:04 index_uuid >>> -rw------- 1 makrand makrand 1679 Jun 7 16:05 private_key >>> -rw-rw-r-- 1 makrand makrand 138 Jun 8 11:19 synced_folders >>> -rw------- 1 makrand makrand 40455 Jun 8 11:19 >>> ubuntu-bionic-18.04-cloudimg-console.log >>> -rw-rw-r-- 1 makrand makrand 34 Jun 7 16:04 vagrant_cwd >>> >>> >>> I am wondering how does public is set into .ssh folder onto VM? Is it >>> created on fly against above private key each time VM is provisioned? >>> >>> >>> I am asking this because - I am setting up RKE (Rancher Kubernetes >>> Engine) on single vagrant launched VM. While I am building the config to >>> launch K8 clsuter....it is asking me to set - *SSH Private Key Path of >>> host* >>> >>> Normally for setting up the passwordless login - one generates both pub >>> and private key & then moves pub key from localhost to deisnation machine. >>> I don't see >>> >>> -- >>> This mailing list is governed under the HashiCorp Community Guidelines - >>> https://www.hashicorp.com/community-guidelines.html. Behavior in >>> violation of those guidelines may result in your removal from this mailing >>> list. >>> >>> GitHub Issues: https://github.com/hashicorp/vagrant/issues >>> Discuss: https://discuss.hashicorp.com/c/vagrant/24 >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Vagrant" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to vagra...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/vagrant-up/250f6600-2ef0-4e56-a04a-51a0cf10ef78o%40googlegroups.com >>> <https://groups.google.com/d/msgid/vagrant-up/250f6600-2ef0-4e56-a04a-51a0cf10ef78o%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Alvaro >> >> -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/hashicorp/vagrant/issues > Discuss: https://discuss.hashicorp.com/c/vagrant/24 > --- > You received this message because you are subscribed to the Google Groups > "Vagrant" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vagrant-up+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vagrant-up/655ee2e5-2d59-4c27-803c-9d2399e21aaao%40googlegroups.com > <https://groups.google.com/d/msgid/vagrant-up/655ee2e5-2d59-4c27-803c-9d2399e21aaao%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/hashicorp/vagrant/issues Discuss: https://discuss.hashicorp.com/c/vagrant/24 --- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAAf6Gaf-3HgfhJCeZPyRLz1txaRmaz2L60mtuunkAg5bkkYh2Q%40mail.gmail.com.