SSH服务参数使用方法

LoginGraceTime 2m

LoginGraceTime 2m       #grace 优雅

# 当使用者连上 SSH server 之后,会出现输入密码的画面,在该画面中在多久时间内没有成功连上SSH server 就强迫断线!若无单位则默认时间为秒!

 PermitRootLogin yes

PermitRootLogin yes

#是否允许 root 登入!预设是允许的,但是建议设定成 no !生产环境服务器,是不允许root账号登陆的!!!

 PasswordAuthentication yes

PasswordAuthenticationyes

# 密码验证当然是需要的!所以这里写 yes,也可以设置为no

#在真实的生产服务器上,根据不同安全级别要求,有的是设置不需要密码登陆的,通过认证的秘钥来登陆

PermitEmptyPasswords no

#PermitEmptyPasswords no

# 若上面那一项如果设定为 yes 的话,这一项就最好设定为 no ,

# 这个项目在是否允许以空的密码登入!当然不许!

PrintMotd yes

# PrintMotd yes

# 登入后是否显示出一些信息呢?例如上次登入的时间、地点等等,预设是 yes

# 亦即是打印出 /etc/motd 这个文档的内容。

例:给sshd服务添加一些警告信息

[root@host ~]# cat/etc/motd

[root@host  ~]# echo'Warning ! From now on, all of your operation has been 4record!'> /etc/motd

测试:

ssh 192.168.0.64

[email protected]'spassword:

Last login: Thu Jun23 14:02:38 2016 from 192.168.0.1

Warning ! From nowon, all of your operation has been record!

警告!从现在开始,你所有的操作已经被记录!

PrintLastLog yes

# PrintLastLog yes

# 显示上次登入的信息!预设也是 yes  !例:

ssh 192.168.0.63

Last login: TueNov  4 19:57:31 2014 from 192.168.1.107  #就是这个信息

 UseDNS yes

# UseDNS yes

#一般来说,为了要判断客户端来源是正常合法的,因此会使用 DNS 去反查客户端的主机名

# 不过如果是在内网互连,这项目设定为 no 会让联机速度比较快。