5.6. 服务器: 配置 sshd

以下是我的/etc/sshd_config文件的内容。您的文件应该与其相同或相似。

# This is the ssh server system wide configuration file.

Port 22
ListenAddress 0.0.0.0
HostKey /etc/ssh_host_key
RandomSeed /etc/ssh_random_seed
ServerKeyBits 768
LoginGraceTime 600
KeyRegenerationInterval 3600
PermitRootLogin yes
IgnoreRhosts yes
StrictModes yes
QuietMode no
FascistLogging yes
CheckMail no
IdleTimeout 3d
X11Forwarding no
PrintMotd no
KeepAlive yes
SyslogFacility DAEMON
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
UseLogin no

需要注意的重点是,密码验证已被禁用,所有"R"服务也被禁用。我还关闭了邮件检查和每日消息,因为它们可能会混淆客户端的 pppd。 我仍然允许 root 登录,但由于这只能通过密钥完成,因此足够安全。