树莓派使用SSH Key登录

开启SSH Key登录

仅作为已有key情况下的个人操作记录

使用

1
mkdir ~/.ssh

建立放入key的文件夹

使用

1
cd ~/.ssh

进入该文件夹

使用

1
touch authorized_keys

生成树莓派用来保存公钥的文件

接下来把已有的公钥拷贝到authorized_keys

使用

1
sudo nano /etc/ssh/sshd_config

编辑sshd_config文件

取消注释PubkeyAuthentication yes

关闭密码登录

取消注释PasswordAuthentication no

最终使用

1
sudo systemctl restart sshd.service

使改变生效