ssh without "vagrant ssh"

Showing 1-14 of 14 messages
ssh without "vagrant ssh" Suraj Gupta 6/10/12 9:30 AM
Is it possible to use plain-old-ssh to ssh into all VMs that have been started via 'vagrant up' and not 'vagrant ssh'?  I'm using the tutorial - so the lucid32 box without any modification to my Vagrantfile(s).  When I 'vagrant up' two or more virtual environments what are the hosts? ports? and what commands will provide that info?
Re: [vagrant-up] ssh without "vagrant ssh" Babar 6/10/12 11:42 AM
vagrant ssh_config

--
Babar.
Re: [vagrant-up] ssh without "vagrant ssh" Nathan Fisher 6/11/12 1:54 AM
You can redirect that output into a file and use "ssh -C OUTFILE.TXT HOST".--
Nathan Fisher
 m: +61 4 0641 8380

Re: [vagrant-up] ssh without "vagrant ssh" Nathan Fisher 6/11/12 2:16 AM
That should be -F not -C.
Re: [vagrant-up] ssh without "vagrant ssh" Suraj Gupta 6/11/12 6:51 AM
I piped the output of vagrant ssh-config to OUTFILE.txt and ran ssh -F.
is "HOST" a placeholder for localhost?

ssh -F OUTFILE.txt HOST
seems to nothing...as if bash is waiting for more commands

ssh -F OUTFILE.txt localhost
takes me down the route of ssh'ing into my own machine with the same user account, not vagrant
Re: [vagrant-up] ssh without "vagrant ssh" Suraj Gupta 6/14/12 10:36 AM
Ok, I got this to work by calling ssh with the info provided in OUTFILE.txt, instead of -F.
not sure why the file won't work as-is.
Re[2]: [vagrant-up] ssh without "vagrant ssh" Babar 6/14/12 10:45 AM
On Thu, Jun 14, 2012 at 10:36:02AM -0700, Suraj Gupta wrote:
>    Ok, I got this to work by calling ssh with the info provided in
>    OUTFILE.txt, instead of -F.
>
>    not sure why the file won't work as-is.

OK, I guess I wasn't verbose enough. For ssh, what I normally use is the
following:

vagrant ssh_config | ssh -F /dev/stdin default

This also works with scp:
vagrant ssh_config | scp -F /dev/stdin default:some_file .

--
Babar.
Re: [vagrant-up] ssh without "vagrant ssh" John Hume 6/14/12 3:31 PM

It wasn't working because you weren't using the host alias ("default") in your command.

-- typed with my thumbs

Re: [vagrant-up] ssh without "vagrant ssh" Suraj Gupta 6/15/12 7:07 AM
Babar, John - thanks!  it worked!
Re: [vagrant-up] ssh without "vagrant ssh" bmau 8/1/12 2:44 PM
What do you mean by the host alias ("default")?

Running vagrant ssh_config | ssh -F /dev/stdin default doesn't work for me
Re: [vagrant-up] ssh without "vagrant ssh" John Hume 8/2/12 5:33 AM
That is what I meant. That form of the command works for me. I'm on a
machine w/o vagrant installed right now, but I happen to have a file
with the output of vagrant ssh_config handy, and this looks to me like
it would work if a vagrant box were up and running:

$ cat test/vagrant/vagrant.ssh.config | ssh -F /dev/stdin default
Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh: connect to host 127.0.0.1 port 2222: Connection refused

The file test/vagrant/vagrant.ssh.config contains this:
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/user/.vagrant.d/insecure_private_key
  IdentitiesOnly yes

What output are you seeing? What does `vagrant ssh_config` output?
--
http://elhumidor.blogspot.com/
http://www.intentmedia.com/jobs
Re: [vagrant-up] ssh without "vagrant ssh" bmau 8/2/12 10:43 AM
Right that's basically exactly what I get.

vagrant ssh-config | ssh -F /dev/stdin default

Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.

It doesn't actually SSH in
Re: [vagrant-up] ssh without "vagrant ssh" John Hume 8/3/12 4:15 AM

It occurs to me that ssh needs stdin for you to interact with it, so I think you'll need to write ssh_config to a real file and then point the -F option at it.

-- typed with my thumbs

Re: ssh without "vagrant ssh" Ambles Kwok 1/29/13 12:15 PM
Execute the following command:

vagrant ssh-config | grep IdentityFile  | awk '{print $2}'

Then you should get something like:

/<somepath>/<username>/.vagrant.d/insecure_private_key

Now you can ssh into the VM by:

ssh 127.0.0.1 -p 2222  -i /<somepath>/<username>/.vagrant.d/insecure_private_key -l vagrant