LoginSignup
11
9

More than 5 years have passed since last update.

VagrantでSSHする際にカレントディレクトリを/vagrantに設定する

Posted at

Vagrantでは、/vagrantがSynced Folderに設定されているため、ホームディレクトリではなく、/vagrantで作業することが多いのでは無いかと思います。

そこで、VagrantのVMにSSHする際に、SSHで/vagrantが開くように設定してみたいと思います。以下のコマンドで可能です。

$ vagrant ssh -c "cd /vagrant; bash"

.zshrcあたりに下記のような感じで設定しておくと、vsshで上記コマンドを使えるようになって便利です。

alias vssh='vagrant ssh -c "cd /vagrant; bash"';
11
9
0

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
11
9