レンタルサーバLolipopにパスワード無しでSSH接続する
かなり雑ですが、メモです。
基本、クライアント側の手順でOKです。
Step1 公開鍵、秘密鍵の生成
$ssh-keygen - t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/ユーザ名/.ssh/id_rsa): ※そのままエンター Enter passphrase (empty for no passphrase): ※そのままエンター Enter same passphrase again: ※そのままエンター Your identification has been saved in /home/ユーザ名/.ssh/id_rsa Your public key has been saved in /home/ユーザ名/.ssh/id_rsa.pub The key fingerprint is: SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxx ユーザ名@zzzz The key's randomart image is:
Step 3 公開鍵をサーバ(ロリポップ)に渡す
$ ssh-copy-id -i /home/ユーザ名/.ssh/id_rsa.pub -p 2222 ロリポップのユーザ名@ssh.lolipop.jp /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys ロリポップのユーザ名@ssh.lolipop.jp's password: ※ロリポップのSSH接続のパスワードを入力 client_global_hostkeys_private_confirm: server gave bad signature for RSA key 0: incorrect signature Number of key(s) added: 1 Now try logging into the machine, with: "ssh -p '2222' 'ロリポップのユーザ名@ssh.lolipop.jp'" and check to make sure that only the key(s) you wanted were added.