SSH - Permission denied (publickey).

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SSH - Permission denied (publickey).

Tadeu Bernacchi
Olá pessoal boa tarde,

Sou novo no Vagrant e achei muito interesante sua proposta e estou tentando utilizá-lo para subir umas máquininhas para estudo, porém estou tendo dificuldades com o SSH.

Esse é meu Vagrantfile

# -*- mode: ruby -*-
# # vi: set ft=ruby :

###CONFIGURACOES DOS HOSTS-ANSIBLE
Vagrant.configure("2") do |config|

   config.vm.define "ansible2" do |ansible2|
     ansible2.vm.box = "debian/jessie64"
     ansible2.vm.hostname = "ansible2"
     ansible2.vm.network "private_network", ip: "192.168.33.102"
end
end 

Já instalei o GuestAdditions e a VM sobe normal, porém quando tento SSH de outro terminal, ou mesmo de outro local que não tenha o Vagrantfile ele dá esse erro:

root@notebook:~# ssh -l vagrant ansible2
Permission denied (publickey).


Quando tento passando a chave eu consigo logar:

root@notebook:~# ssh -i /home/tadeu/projetos-vagrant/ansible/.vagrant/machines/ansible2/virtualbox/private_key -p 22 [hidden email]  

Existe alguma outra forma de passar essa chave para o Vagrantfile? Vi que existe a diretiva  "config.ssh.private_key_path" mas também não deu certo. 

Queria deixar a conexão SSH com as VM's o mais simples possível pois comecei a estudar Ansible e ele precisa do SSH pra rodar os comandos.

Enfim, desculpem pelo tamanho da publicação, e qualquer ajuda será bem vinda!!

Obrigado! 

--
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/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/d8ea983b-453a-4efa-82c5-b9f92252a2b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SSH - Permission denied (publickey).

Alvaro Miranda Aguilera
Hello

If you want to login from ther machine, you should do what you would in a normal server.

a. Set a password to the user.
b. add the public key of the ssh key of the remote user.

No need to share the private key with all the machines.

You can also create your own pair of ssh key, add the pub to the new guest, and use that private from remote systems

same options as you would be doing it on a server without Vagrant.

Alvaro

2017-05-04 19:05 GMT+02:00 Tadeu Bernacchi <[hidden email]>:
Olá pessoal boa tarde,

Sou novo no Vagrant e achei muito interesante sua proposta e estou tentando utilizá-lo para subir umas máquininhas para estudo, porém estou tendo dificuldades com o SSH.

Esse é meu Vagrantfile

# -*- mode: ruby -*-
# # vi: set ft=ruby :

###CONFIGURACOES DOS HOSTS-ANSIBLE
Vagrant.configure("2") do |config|

   config.vm.define "ansible2" do |ansible2|
     ansible2.vm.box = "debian/jessie64"
     ansible2.vm.hostname = "ansible2"
     ansible2.vm.network "private_network", ip: "192.168.33.102"
end
end 

Já instalei o GuestAdditions e a VM sobe normal, porém quando tento SSH de outro terminal, ou mesmo de outro local que não tenha o Vagrantfile ele dá esse erro:

root@notebook:~# ssh -l vagrant ansible2
Permission denied (publickey).


Quando tento passando a chave eu consigo logar:

root@notebook:~# ssh -i /home/tadeu/projetos-vagrant/ansible/.vagrant/machines/ansible2/virtualbox/private_key -p 22 [hidden email]  

Existe alguma outra forma de passar essa chave para o Vagrantfile? Vi que existe a diretiva  "config.ssh.private_key_path" mas também não deu certo. 

Queria deixar a conexão SSH com as VM's o mais simples possível pois comecei a estudar Ansible e ele precisa do SSH pra rodar os comandos.

Enfim, desculpem pelo tamanho da publicação, e qualquer ajuda será bem vinda!!

Obrigado! 

--
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/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/d8ea983b-453a-4efa-82c5-b9f92252a2b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
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/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ewoGQYe9_Pj77vsusCZ1q92T05fAMtOGiA4qyeNEVSqhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.