关于sshd的一些简单配置

2019-04-28  本文已影响0人  小胖_20c7
ssh免密登陆
1 ssh-keygen(生成一对公钥和私钥):
      ssh-keygen(根据提示生成公钥,私钥对儿)
      ssh-keygen -t rsa(指定加密类型)
2 ssh-copy-id(将公钥copy到远程主机)
      ssh-copy-id root@172.16.2.220
      ssh-copy-id -i ~/.ssh/id_rsa.pub root@172.16.2.220(指定公钥)
3 注意项:
      要保证.ssh和authorized_keys都只有用户自己有写权限
sshd相关路径
1 /etc/ssh/(服务器各种类型公钥和私钥,以及sshd服务器配置)
2 ~/authorized_keys(作为server,允许免密登录该账户的public key)
3 ~/known_hosts(作为client,信任的远程主机信息)
sshd_config配置
1 PermitRootLogin yes
2 PermitEmptyPasswords no
3 UsePAM yes(ChallengeResponseAuthentication yes)
4 UsePAM  no(PasswordAuthentication yes)
5 GSSAPIAuthentication no
ssh-keygen的常用命令形式
1 ssh-keygen -A(生成/etc/ssh下面所有类型公钥,私钥对儿)
2 ssh-keygen -R 172.17.0.2(作为client,移除信任的远程主机)
ssh服务配置
1 编译时的配置
2 服务器全局配置
3 每个账户的服务器配置
上一篇下一篇

猜你喜欢

热点阅读