LoginSignup
1
1

More than 3 years have passed since last update.

ssh接続方法

Posted at

SSH接続ができるようになるまで

パスワード認証を聞かれたくない人用です

まずは公開鍵と秘密鍵を作成

ssh-keygen

これで
id_rsa.pub 公開鍵
id_rsa 秘密鍵
ができます。

公開鍵をサーバーにアップロードしてそれをauthorized_keysとして登録

ssh-copy-id -i ~/.ssh/id_rsa.pub user@xxx.xxx.xx.xx

サーバー側の設定を書き換える

sudo vim /etc/sshsshd_congig

PublickeyAuthentication yesのところ#をとってコメントアウトを外し、sshdを再起動する

service ssh restart

最終的にこれで接続すればパスワード聞かれない

ssh -i ~/.ssh/id_rsa.pub user@xxx.xxx.xx.xx
1
1
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
1
1