質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

1回答

2541閲覧

Vagrantfile作成後、ローカル内にあるはずの~/.ssh/configが存在しない

roronoazoro

総合スコア113

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2017/06/18 07:35

編集2017/06/18 07:36

vagrantについて質問です。現在、schooのvagrantの授業を参考に仮想環境を整えています。
OSはubuntu/trusty64(virtualbox, 20170613.0.0)をしようしております。

作業手順
0. vagrant box add ubuntu/trusty64 URL
0. vagrant init
0. vim ~/.ssh/config

3を試すが.sshファイルはあるものの、configは見当たらない。
先生の方では、存在し、vimで編集を行えます。

他に何を設定すればいいのかわからず、自己解決できそうにありません。
アドバイス頂けるとありがたいです。
下記にVagrantfileを乗せておきます。
よろしくお願いします。

Vagrantfile

bash

1# -*- mode: ruby -*- 2# vi: set ft=ruby : 3 4# All Vagrant configuration is done below. The "2" in Vagrant.configure 5# configures the configuration version (we support older styles for 6# backwards compatibility). Please don't change it unless you know what 7# you're doing. 8Vagrant.configure("2") do |config| 9 # The most common configuration options are documented and commented below. 10 # For a complete reference, please see the online documentation at 11 # https://docs.vagrantup.com. 12 13 # Every Vagrant development environment requires a box. You can search for 14 # boxes at https://atlas.hashicorp.com/search. 15 config.vm.box = "ubuntu/trusty64" 16 17 # The url from where the 'config.vm.box' box will be fetched if it 18 # doesn't already exist on the user's system. 19 config.vm.box_url = "20170613.0.0" 20 21 # Create a forwarded port mapping which allows access to a specific port 22 # within the machine from a port on the host machine. In the example below, 23 # accessing "localhost:8080" will access port 80 on the guest machine. 24 # NOTE: This will enable public access to the opened port 25 # config.vm.network "forwarded_port", guest: 80, host: 8080 26 27 # Create a forwarded port mapping which allows access to a specific port 28 # within the machine from a port on the host machine and only allow access 29 # via 127.0.0.1 to disable public access 30 # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" 31 32 # Create a private network, which allows host-only access to the machine 33 # using a specific IP. 34 # config.vm.network "private_network", ip: "192.168.33.10" 35 36 # Create a public network, which generally matched to bridged network. 37 # Bridged networks make the machine appear as another physical device on 38 # your network. 39 # config.vm.network "public_network" 40 41 # Share an additional folder to the guest VM. The first argument is 42 # the path on the host to the actual folder. The second argument is 43 # the path on the guest to mount the folder. And the optional third 44 # argument is a set of non-required options. 45 # config.vm.synced_folder "../data", "/vagrant_data" 46 47 # Provider-specific configuration so you can fine-tune various 48 # backing providers for Vagrant. These expose provider-specific options. 49 # Example for VirtualBox: 50 # 51 # config.vm.provider "virtualbox" do |vb| 52 # # Display the VirtualBox GUI when booting the machine 53 # vb.gui = true 54 # 55 # # Customize the amount of memory on the VM: 56 # vb.memory = "1024" 57 # end 58 # 59 # View the documentation for the provider you are using for more 60 # information on available options. 61 62 # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies 63 # such as FTP and Heroku are also available. See the documentation at 64 # https://docs.vagrantup.com/v2/push/atlas.html for more information. 65 # config.push.define "atlas" do |push| 66 # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" 67 # end 68 69 # Enable provisioning with a shell script. Additional provisioners such as 70 # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the 71 # documentation for more information about their specific syntax and use. 72 # config.vm.provision "shell", inline: <<-SHELL 73 # apt-get update 74 # apt-get install -y apache2 75 # SHELL 76end

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yoorwm

2017/06/18 08:19

vagrantを使用するのに.ssh/configを自分でいじる必要はなかったと思うのですが、何をテキストに実習を進めているのでしょうか?(というか、先生がついているのなら先生に質問するべきかと思います。)
roronoazoro

2017/06/18 08:44 編集

実用度は低いみたいですね。録画授業を参考に進めております。configを設定すれば、どのディレクトリからでも、「ssh 任意の名前」でログインできるようです。録画授業だったため、こちらで質問させていただきました。
yoorwm

2017/06/18 10:49

「録画授業」では、あなたが一体、何を吹き込まれて妙な事をしようとしているのか?が分からないと思います。「「ssh 任意の名前」でログインできるようです。」という内容自体恐らく間違えていますが、要はvagrantで建てたゲストOSの方にSSHでログインする方法を知りたいという事なのではないかと思いますがどうでしょうか?
roronoazoro

2017/06/18 11:10 編集

vagrantを勉強し始めたばかりなので認識不足な面は多々あります。 やりたいことは、vagrantで建てたゲストOSにホスト名をつけてログインすることで、それを行うためには.ssh/configをいじる必要があるみたいなのですが、configが見当たらなかったので質問してみました。
guest

回答1

0

vagrant がssh の設定を知っているので、それを訊いてみるといいとおもいます

console

1cd my_vagrant_directory 2vagrant up 3vagrant ssh-config

設定情報は、標準出力に表示されるので、それをそのまま設定ファイルに追記しても良いかもしれません

console

1# 一連の設定情報を myHost というID でファイルに追記 2vagrant ssh-config --host myHost >> ~/.ssh/config

console

1ssh myHost # myHost に接続

簡単に調べてみましたが、何か参考になれば幸いです

Links

投稿2017/06/18 18:01

gouf

総合スコア2321

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問