Commandes Linux : vagrant ssh


Commande : vagrant ssh
Usage: vagrant ssh [options] [name|id] [-- extra ssh args]


    -c, --command COMMAND            Execute an SSH command directly
    -p, --plain                      Plain mode, leaves authentication up to user
    -t, --[no-]tty                   Enables tty when executing an ssh command (defaults to true)
    -h, --help                       Print this help


Se connecter à une machine Vagrant via SSH

vagrant ssh [options] [name|id] [-- extra ssh args]

Le fichier Vagrantfile est situé dans le répertoire courant.
ex :

$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:
New release '14.04.5 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:23:18 2012 from


Exécuter une commande sur la machine Vagrant et quitter

vagrant ssh -c "<command>"

ex :

$ vagrant ssh -c "sudo yum update -y"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package acl.x86_64 0:2.2.49-6.el6 will be updated
---> Package acl.x86_64 0:2.2.49-7.el6_9.1 will be an update