Read more

Vagrant: create entry for box in .ssh/config

Daniel Straßner
August 16, 2017Software engineer at makandra GmbH

If you want to ssh into your vagrant box without switching into the project directory and typing vagrant ssh, you can also create an entry directly in ~/.ssh/config. This will allow you to use ssh <my-box> from anywhere. Simply paste the information provided by vagrant ssh-config to your ~/.ssh/config-File: vagrant ssh-config >> ~/.ssh/config

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Example:

$ vagrant ssh-config
Host foobar-dev
  HostName 127.0.0.1
  User vagrant
  Port 2200
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/daniel/project/myproject/vagrant/.vagrant/machines/foobar-dev/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

Background:

Vagrant Show archive.org snapshot is a tool that allows you to define a Virtual Machine (Image to use, network settings, shared folders to mount...) in a configuration file (Vagrantfile). It's also possible to directly provision the VM with a CMS like Puppet to have the machine in a desired state. Upon creation Vagrant will set up a new VM and add a SSH-Key so you can ssh into the machine. Normally you would switch to the directory containing the Vagrantfile and use the command line tool vagrant ssh to log in to your machine.

Posted by Daniel Straßner to makandra dev (2017-08-16 10:01)