-1

Here is the problem. After vagrant up in an Ubuntu 12.04 box, I create a custom user:

sudo useradd -m USER_NAME

And I add it to the same groups than the vagrant user. After that, I try to login with SSH but I can't find the way. I generate a SSH key pair with ssh-keygen , and set the following option in the Vagrantfile:

config.ssh.username = "USER_NAME"

So doing vagrant ssh allows me to enter the user password and log in as that user, but not directly with a SSH key pair. I think that I have to set up the config variable:

config.ssh.private_key_path = ""

But I don't know how... What path to set and where to place the public and private keys. It is probably a more conceptual problem with SSH than with Vagrant, but I've been with this for hours, any hint? Thanks

Ignacio
  • 688
  • 5
  • 17

1 Answers1

1

Please refer to the answer here: SSH onto Vagrant Box With Different Username

To troubleshoot:

  1. make sure the user has a login shell grep user_name /etc/passwd | cut -d : -f 7

  2. I haven't tried the config.ssh parameters but you should be able to test the ssh login by using

ssh -p 2222 USER_NAME@localhost

or (on Linux)

ssh -p 2222 -i /opt/vagrant/embedded/gems/gems/vagrant-1.5.2/keys/vagrant.pub USER_NAME@localhost

If you see error messages, enable ssh verbose logging by adding -vvv. You should be able to figure out the cause and take it from there.

Community
  • 1
  • 1
Terry Wang
  • 13,840
  • 3
  • 50
  • 43