Help us understand the problem. What is going on with this article?

とにかくすばやくEC2環境を作るメモ

More than 3 years have passed since last update.

前提

  • AWS 管理コンソールで Amazon LinuxEC2 インスタンスを作成済
  • SSH 接続用の pem ファイルを取得済

pemファイルを使えるように

chmod 400 XXX.pem

SSHログイン

ssh -i /path/tp/pem/XXX.pem ec2-user@xx.xxx.xxx.xxx

ユーザーを作成する

sudo useradd newuser
sudo passwd newuser

新しいユーザーがsudoできるように

sudo visudo

以下を追加

newuser    ALL=(ALL)       ALL

pemなしでアクセスできるように公開鍵を登録

ローカル

cat ~/.ssh/id_rsa.pub

でてきた内容をコピー。公開鍵がない場合は ssh-keygen -t rsa で作ってから。

EC2

su - newuser
vim ~/.ssh/authorized_keys

ローカルでコピーした公開鍵の内容を貼り付けて保存。複数人が使うなら改行して複数貼り付ける。
続けてパーミッションの設定。

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

ローカルから

ssh newuser@XX.XXX.XXX.XXX

でアクセスできれば成功。

すばやく何かに使える環境ができました。

以上。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away