1
1

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 1 year has passed since last update.

terminating, 1 bad configuration optionsエラーが発生してssh接続ができなくなった。

1
Last updated at Posted at 2022-09-28

1.エラー

vagrant upをしたのち、vagrant sshでssh接続を実行するもエラーが発生して接続できない。

/Users/********/.ssh/config: terminating, 1 bad configuration options

2.エラーの解析

どうやら.ssh配下にあるconfigファイルに以上があるみたいです。そこで、configファイルを開いてみました。

.ssh/config
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config

Host test
    HostName 127.0.0.1
    User vagrant
    Port 2222
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no
    PasswordAuthentication no
    IdentityFile /Users/kawakamiyouhei/vagrant/.vagrant/machines/default/virtualbox/private_key
    IdentitiesOnly yes
    LogLevel 

あっ!!一番最後の行LogLevelの横にFATALの記述がない!!ネットの記事でconfigファイルを見比べて気が付きました。偶然でした。

3.configファイルの修正

ということで、最後の行にFATALを記述しましょう!

Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/kawakamiyouhei/vagrant/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

vimで記入しました。

4.確認

記入できたら、vagrant reloadを実行してもう一度vagrant sshで接続。

$ vagrant reload
$ vagrant ssh

すると・・・

[vagrant@localhost ~]$ 

接続できました!!

5.最後に

今回のエラーはconfigファイルに記載漏れがあってのエラーでしたが、ファイルを修正した記憶もないし、そもそもconfigファイルなんて普段使わないから開けることもありませんね〜。なので、原因不明ww
しかし、terminating, 1 bad configuration optionsというエラーが出たら、configファイルに異常があるので、正しいconfigファイルをネットで探して自分のと見比べてみるといいですね。
エラーが出たときは、かなり時間がかかるかな〜と思いましたが、今回はすんなり解決出来たよかったです。

6.参考記事

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?