#绝对不要允许 root 用户直接通过网络登录,默认值
PermitRootLogin no
StrictModes yes
MaxAuthTries 6
#启用公钥认证
RSAAuthentication no #默认值为 yes
PubkeyAuthentication yes #默认值
#不使用基于主机的认证,加强 OpenSSH 的安全性
RhostsRSAAuthentication no #默认值
HostbasedAuthentication no #默认值
IgnoreUserKnownHosts yes #默认值为 no
PermitEmptyPassword no #默认值
#禁用 PAM 认证即口令形式认证 默认值为yes
ChallengeResponseAuthentication no
#不输入即使用默认
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Created directory ‘/home/user/.ssh’.
#密钥的密码,需要输入并记住
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
bb:48:db:f2:93:57:80:b6:aa:bc:f5:d5:ba:8f:79:17 user@host.example.com
Login as: test
Authenticating with public key “imported-openssh-key”
Passphrase for key “imported-openssh-key”:
Last login: Wed May 31 12:35:00 2006 from 192.168.1.10
test@server:~$
综上所述:
1.用putty生产 ssh2-rsa,1024 的公钥和私钥。
2.配置redhat 系统自带的openssh
Protocol 2
SyslogFacility AUTHPRIV
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES