sshd
1、通过配置 ~/.ssh/config 文件
错误信息:bad permissions
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for '/home/xxx/.ssh/xxx_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/xxx/.ssh/xxx_rsa": bad permissions
问题原因:秘钥的权限不对,应该改为 600,执行命令 chmod 600 xxx_rsa
2、修改 SSH 端口
vim /etc/ssh/sshd_config
# 把 Port 22 改成其他的端口
# 以后在连接的时候,通过 -p 来指定端口
3、使用 ssh 远程其他机器的时候,如果一段时间没有操作,就会假死,即不能操作了
vim /etc/ssh/sshd_config
# 插入
ClientAliveInterval 30
ClientAliveCountMax 6
# 修改之后需要重启 sshd 服务
systemctl restart sshd
4、生成 rsa
ssh-keygen -t rsa
生成的文件会存放到 /root/.ssh 中
私钥:idea_rea ,公钥:idea_rsa.pub