Skip to main content
The 2024 Developer Survey results are live! See the results
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as your Vagrantfile, assuming you vagrant box is up and running.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use anotheranother variablevariable, or another folder, if it's not set on your system.

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as your Vagrantfile, assuming you vagrant box is up and running.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variable, or another folder, if it's not set on your system.

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as your Vagrantfile, assuming you vagrant box is up and running.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variable, or another folder, if it's not set on your system.

$TMP, link to the project documentation
Source Link
Joel Purra
  • 24.9k
  • 8
  • 61
  • 61

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as youyour Vagrantfile, assuming you vagrant box is up and running.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variable, or another folder, if it's not set on your system.

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as you Vagrantfile.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variable, or another folder, if it's not set on your system.

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as your Vagrantfile, assuming you vagrant box is up and running.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variable, or another folder, if it's not set on your system.

$TMP, link to the project documentation
Source Link
Joel Purra
  • 24.9k
  • 8
  • 61
  • 61

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile-F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as you Vagrantfile.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variableanother variable, or another folder, if it's not set on your system.

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as you Vagrantfile.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variable, or another folder, if it's not set on your system.

Just pass the entire vagrant ssh-config as a config file to ssh with the -F configfile parameter. The host alias to connect to is defined on the first line in vagrant ssh-config; Host default means you can connect with ssh default.

I couldn't see an option to read the config file from the standard input, so went with the temp file route. Here's a one-liner that also cleans up the temporary $TMPDIR.vagrant-ssh-config file afterwards. It needs to be executed in the same directory as you Vagrantfile.

vagrant ssh-config > $TMPDIR.vagrant-ssh-config && ssh default -F $TMPDIR.vagrant-ssh-config ; rm $TMPDIR.vagrant-ssh-config

Note: on my Mac OSX system, $TMPDIR expands to /var/folders/46/yltlhtgx8m5cg68_w95wgvy41324gn/T/ (right now). Use another variable, or another folder, if it's not set on your system.

Source Link
Joel Purra
  • 24.9k
  • 8
  • 61
  • 61
Loading