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

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

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

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

SSH

SSH(Secure Shell)は、セキュアチャネルを通してデータを交換するためのネットワークプロトコルです。リモートサーバーへのコマンド実行やファイル転送を行う時に一般的に使用されます。

Vagrant

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

Q&A

解決済

2回答

1680閲覧

突然ssh接続できなくなった!なぜ?

gomenne

総合スコア16

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

SSH

SSH(Secure Shell)は、セキュアチャネルを通してデータを交換するためのネットワークプロトコルです。リモートサーバーへのコマンド実行やファイル転送を行う時に一般的に使用されます。

Vagrant

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

0グッド

0クリップ

投稿2018/10/22 04:49

編集2018/10/22 13:21

#問題
ほんの数分前までは、vagrant sshで接続できていたのに、突然接続できなくなった。
原因が全く分からなく、解決法も分からないので、ご教授願いたいです。

#試してみたこと
・iTerm再起動
・wifi再接続
・sudo cat /var/log/secure でディレクトリを見ようと思ったが、ディレクトリが存在しなかった

~/vagrant/sample ❯ vagrant ssh ssh_exchange_identification: read: Connection reset by peer ~/vagrant/sample ❯ sudo cat /var/log/secure Password: cat: /var/log/secure: No such file or directory ~/vagrant/sample ❯ ssh -v vagrant OpenSSH_7.7p1, LibreSSL 2.7.3 debug1: Reading configuration data /Users/wataruarata/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: Connecting to vagrant port 22. ssh: Could not resolve hostname vagrant: nodename nor servname provided, or not known

#追加情報
/Users/wataruarata/.ssh/config の中身

❯ cat /Users/wataruarata/.ssh/config 1 Host 192.168.33.10 2 HostName 127.0.0.1 3 User vagrant 4 Port 2222 5 UserKnownHostsFile /dev/null 6 StrictHostKeyChecking no 7 PasswordAuthentication no 8 IdentityFile /Users/wataruarata/vagrant/centos/.vagrant/machines/default/virtualbox/private_key 9 IdentitiesOnly yes 10 LogLevel FATAL 11

vagrant global-status
ssh -vvv vagrant@192.168.33.10

~/vagrant/sample ❯ vagrant global-status id name provider state directory ------------------------------------------------------------------------- 34eb7b1 default virtualbox poweroff /Users/wataruarata/vagrant/centos bfb68ba default virtualbox poweroff /Users/wataruarata/vagrant/Genevs 029b021 default virtualbox running /Users/wataruarata/vagrant/sample 911fab2 default virtualbox poweroff /Users/wataruarata/vagrant/Docker The above shows information about all known Vagrant environments on this machine. This data is cached and may not be completely up-to-date (use "vagrant global-status --prune" to prune invalid entries). To interact with any of the machines, you can go to that directory and run Vagrant, or you can use the ID directly with Vagrant commands from any directory. For example: "vagrant destroy 1a2b3c4d" ~/vagrant/sample ❯ ssh -vvv vagrant@192.168.33.10 OpenSSH_7.7p1, LibreSSL 2.7.3 debug1: Reading configuration data /Users/wataruarata/.ssh/config debug1: /Users/wataruarata/.ssh/config line 1: Applying options for 192.168.33.10 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug2: resolve_canonicalize: hostname 127.0.0.1 is address debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222. debug1: Connection established. debug1: key_load_public: No such file or directory debug1: identity file /Users/wataruarata/vagrant/centos/.vagrant/machines/default/virtualbox/private_key type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/wataruarata/vagrant/centos/.vagrant/machines/default/virtualbox/private_key-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_7.7 ssh_exchange_identification: read: Connection reset by peer

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

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

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

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

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

kazto

2018/10/22 06:07

/Users/wataruarata/.ssh/config の内容を追記お願いできますでしょうか。
gomenne

2018/10/22 10:21

追記しました!
guest

回答2

0

自己解決

mac再起動でいけた。

投稿2018/10/22 13:23

gomenne

総合スコア16

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

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

0

  1. vagrant global-statusの結果
  2. ssh -vvv vagrant@192.168.33.10のログ(たくさん出ますが漏らさず追記をお願いします)

以上二点、お手数ですが追記をお願いします。

投稿2018/10/22 11:33

kazto

総合スコア7196

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

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

gomenne

2018/10/22 12:34

更新しました!よろしくお願いします!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問