Failed to enter the tramp with a tramp after installing ssh keys

I have a new user in my stray field (trusty64) and I am trying to use it. Instead of logging into the vagrant user after vagrant up , I want to log in to my username.

What have i done so far

  • Created a user on my guest machine.
  • Created an ssh key in my host using ssh-keygen
  • I copied the ssh key to the guest system using ssh-copy-id -p 2222 -i shash@127.0.0.1

and the Vagrantfile part looks like this:

  config.vm.box = "ubuntu/trusty64" config.ssh.username = "shash" config.ssh.forward_agent = true config.ssh.private_key_path = "~/.ssh/authorized_keys" 

I can use ssh -p '2222' ' shash@127.0.0.1 ' to log in directly, but when I give vagrant up , I keep getting the following error

 default: Warning: Connection timeout. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... 

Any help in sorting this out is really appreciated. Thanks!

A complete setup guide will be really helpful

+7
vagrant ssh ssh-keys vagrantfile
source share
2 answers

A roaming file will access the users home directory when you specify "~".

config.ssh.private_key_path = "/home/shash/.ssh/authorized_keys"

Let it go!

+1
source share

Add it to the Vagrantfile:

 Vagrant.configure("2") do |config| config.ssh.private_key_path = "~/.ssh/id_rsa" config.ssh.forward_agent = true end 
  • config.ssh.private_key_path is your local private key
  • Your private key must be available to the local ssh agent. You can check with ssh-add -L, if it is not specified, add it with ssh-add ~ / .ssh / id_rsa
  • Remember to add the public key to ~ / .ssh / authorized_keys on the Vagrant VM. You can do this with copy and paste or with a tool like ssh-copy-id

fooobar.com/questions/50217 / ...

+1
source share

All Articles