LoginSignup
1
0

More than 3 years have passed since last update.

ユーザー追加したあとSSHで接続できない人へ

Last updated at Posted at 2019-07-19

参考

こちらでAWSの実践方法が良くわかりました!

解決方法

ご存知の方が多いかと思いますが、こちらの解決策はすでに公式に解凍がございます。
AWS公式リンク

AWSのSSHは癖が強い!単にわたしの技術不足なのだけど。

ユーザ接続しようとすると

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

解決方法

  1. SSHでec2インスタンスに接続
  2. cloud-initをインストール
sudo yum install cloud-init

3. インスタンスを停止
4. キーベアからパブリックキーを取得

ssh-keygen -y -f /path_to_key_pair/my-key-pair.pem

5. ユーザデータの表示変更に次のスクリプトを貼り付ける。usernameとssh-rsaはご自分のものを入力してください。

cloud_final_modules:
- [users-groups,always]
users:
  - name: username
    groups: [ wheel ]
    sudo: [ "ALL=(ALL) NOPASSWD:ALL" ]
    shell: /bin/bash
    ssh-authorized-keys: 
    - ssh-rsa AB3nzExample

詳しくはAWS公式サイトをご確認ください。
https://aws.amazon.com/jp/premiumsupport/knowledge-center/ec2-user-account-cloud-init-user-data/

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