0
0

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.

ユーザーごとにsshの鍵を作成してaws ec2にログイン

Posted at

ローカルでキーペアを作成

$ ssh-keygen -t rsa -C ""
-C ""は公開鍵にユーザー名を載せない為
id_rsa.pub(公開鍵)、id_rsa(秘密鍵)ができる

公開鍵をec2にアップ

今回はコマンドプロンプトでscpします。
scp -i <ec2-userのsshする秘密鍵> <アップする公開鍵> ec2-user@xx.xx.xx.xx:<転送場所>


scp -i .\xxx.pem .\id_rsa.pub ec2-user@11.00.22.33:/home/user01

ec2にログインする

権限変更

cd /home/user01
chmod 700 .ssh
chmod 600 .ssh/authorized_keys

所有権変更

chown user01:user01 .ssh
chown user01:user01 .ssh/authorized_keys

接続

ssh -i $HOME/.ssh/id_rsa user01@$SERVER

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?