備忘録
[クライアント]
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/schoolphoto/.ssh/id_rsa):【←そのままEnter】
Created directory '/home/ユーザー/.ssh'.
Enter passphrase (empty for no passphrase):【←そのままEnter】
Enter same passphrase again:【←そのままEnter】
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:
aa:zz:zz:dd:zz:ff:xx:xx:xx:xx・・・ ユーザー@xx.xx.xx
/home/ユーザー/.ssh/ に以下の2つのファイルが出来ていることを確認
[to リモート]
ssh-copy-id -i ~/.ssh/id_rsa.pub user@192.168.xx.xx
(exsiの場合 パスが違うので以下のようにcatで追記)
cat ~/.ssh/id_rsa.pub | ssh root@192.168.x.x "cat >> /etc/ssh/keys-root/authorized_keys"
(qnapの場合)
cat ~/.ssh/id_rsa.pub | ssh admin@192.168.x.x "cat >> /etc/config/ssh/authorized_keys"
(windows powershellからlinux)
cat ~/.ssh/id_rsa.pub | ssh USER@192.168.xx.xx "cat >> /home/USER/.ssh/authorized_keys"