LoginSignup
5
7

More than 5 years have passed since last update.

ssh公開鍵認証設定

Posted at

クライアント側で公開鍵、秘密鍵を作成しサーバに公開鍵転送

$ ssh-keygen -t rsa
$ scp ~/.ssh/id_rsa.pub USER@REMOTE_HOST:.

~/.ssh/id_rsa ~/.ssh/id_rsa.pub を作成し、~/.ssh/id_rsa.pub を転送。

パーミッション

~/.ssh/id_rsaは600or400でないとダメ。
~/.ssh は700以下?

サーバ側で転送された公開鍵を設定

$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
$ chmod 755 ~/.ssh/authorized_keys

パーミッション

authorized_keysは755以下に設定。
~/.ssh は700以下?

公開鍵を指定してのログイン方法

$ ssh -i ~/.ssh/id_rsa USER@REMOTE_HOST
5
7
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
5
7