LoginSignup
0
1

More than 3 years have passed since last update.

EC2にログインできなかったときに参考にする記事一覧

Last updated at Posted at 2019-09-05

はじめに

EC2インスタンスにSSH接続ができない状況があったので、その一覧を以下に記述します。

内容

【インスタンスを作り直してやる処理】

  1. インスタンスにアタッチされているEBSのスナップショットを作りバックアップ
  2. 作業用インスタンスを作成する
  3. 作業用インスタンスに、対象インスタンスのEBSをアタッチとマウント

※参考:https://qiita.com/keisuke_kimura/items/a7c79f4ab3a954a41780

【「/etc/ssh/sshd_config」のAllowUsersを設定してやる処理】

  1. 「less /var/log/secure」で「not allowed because not listed in AllowUsers」ログを確認
  2. 「sudo less /etc/ssh/sshd_config | grep "AllowUsers"」でAllowUsersを確認
  3. viでAllowUsersを消す、もしくは追加したいユーザを追加する

※参考:https://qiita.com/toshihirock/items/897776cfa620c3231737

【homeディレクトリのパーミッションが所有ユーザー以外に書き込み権限があるとアクセスが拒否対処】

  1. 「less /var/log/secure」で「Authentication refused: bad ownership or modes for directory /home/hoge」ログを確認
  2. StrictModesをnoに設定
$ vim /etc/ssh/sshd_config
StrictModes no

※参考:http://teketeke55.hatenablog.com/entry/2012/02/02/165238

【「Failed to add the host to the list of known hosts」といわれる場合の対処】

  1. オーナー変更
sudo chown username /Users/username/.ssh/known_hosts
  1. 権限変更
sudo chmod 600 /Users/username/.ssh/known_hosts

※参考:https://teratail.com/questions/59913

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