1.生成公钥和私钥
Shell代码
ssh-keygen -t rsa
默认在 ~/.ssh目录生成两个文件:
id_rsa :私钥
id_rsa.pub :公钥
2.导入公钥到认证文件,更改权限
2.1 导入本机
Shell代码
Shell代码
ssh-keygen -t rsa
默认在 ~/.ssh目录生成两个文件:
id_rsa :私钥
id_rsa.pub :公钥
2.导入公钥到认证文件,更改权限
2.1 导入本机
Shell代码
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Shell代码
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys