LoginSignup
0
0

More than 5 years have passed since last update.

SSH公開鍵認証設定

Posted at

クライアントにLinux環境(Cygwin)&OpenSSLがインストールされている前提

1.クライアントでキーペア作成
cd ~/.ssh/
ssh-keygen -t rsa -f hoge_rsa
scp ./hoge_rsa.pub myaws:~/.ssh/
※myawsは、.ssh/config で定義。

2.サーバで公開鍵の登録
cd ~
chmod 700 .ssh
cd .ssh
cat hoge_rsa.pub >> authorized_keys
chmod 600 authorized_keys
rm -fv hoge_rsa.pub

3.テスト
ssh -i ~/.ssh/hoge_rsa ec2-user@HOSTNAME

4.configに登録
vi ./ssh/config
Host myaws
HostName xxxx.xxxx.xxxx.xxxx
Port 22
IdentityFile ~/.ssh/hoge_rsa
User ec2-user
TCPKeepAlive yes
ServerAliveInterval 60
IdentitiesOnly yes

5.再度テスト
ssh myaws

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