Linux远程登陆

1. 远程机器root账号(也可以是自定义的账号abc). 进入.ssh/authorized_keys 文件。没有的话在用户下新建一个相同目录的文件出来

2. 将本地登陆机的%userprofile%/.ssh/id_rsa.pub文件内容 (ssh-rsa 打头的) append到上面_keys文件中

3. 改文件权限 chmod 700 .ssh && chmod 644 .ssh/authorized_keys

4. 配置文件更改:
vi /etc/ssh/sshd_config 将 PermitRootLogin yes 开启。(如果第一步不是root可以忽略). 将 PubkeyAuthentication yes 开启

5。 重启sshd 服务。  

systemctl restart sshd

6. 远程机器登陆 用户名是第一步中的用户。 (root或者abc)

密钥匙 %userprofile%/.ssh/id_rsa: 私钥

原理:远程机器上的公钥和本地的私钥配对后成功登陆

原文地址:https://www.cnblogs.com/ygshen/p/6972623.html