15
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VagrantのゲストOSとホストOSをscpでファイルのやり取り

Posted at

やりたいこと

  • vagrantで立ち上げた仮想マシン(ゲストOS)にホストOSからファイルをSCPで共有したい
  • また、逆もやってみたい

ホストOS > ゲストOS

$ vagrant ssh-config > ssh.config
$ scp -P 2200 -F ssh.config -r .vim vagrant@localhost:/home/vagrant/

このポート番号は、vagrant ssh-configで確認することが出来ます。

ゲストOS > ホストOS

$ scp -P 2200 -F ssh.config vagrant@localhost:/home/vagrant/hoge.txt .
$ cat hoge.txt
ゲストOSで作ったファイル:
15
13
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?