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 5 years have passed since last update.

sshの接続方法をパスワードから鍵認証に変える

Posted at

scpなどをする時に、パスワード認証だと毎回打つのがめんどくさいが、どこかにテキストとして保存するのも危険ですよね。
その時は、鍵認証に変えてしまうのが早いかと思われます。

前提

id_rsa, id_rsa.pubなどは手元にある。→なければ公開鍵と秘密鍵の生成を行ってください。

方法

scp ~/.ssh/id_rsa.pub user@ip:/home/USER/.ssh

として移動します。そこで、すでに
authorized_keys
①存在すれば

cat id_rsa.pub >> authorized_keys

②存在しなければ

mv id_rsa.pub authorized_keys

とします。
その後、

chmod 600 authorized_keys

で権限を変えれば完了です。

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?