centos8 查看登录日志,添加限制ip访问

查看登录成功的用户信息

last | less 
  • 1

查看登录失败的用户信息

lastb | less 
  • 1

查看登录日志

tail /var/log/secure 
  • 1

限制IP登录

vim /etc/hosts.deny

# # hosts.deny This file contains access rules which are used to

# deny connections to network services that either use

# the tcp_wrappers library or that have been

# started through a tcp_wrappers-enabled xinetd.

# # The rules in this file can also be set up in

# /etc/hosts.allow with a 'deny' option instead.

# # See 'man 5 hosts_options' and 'man 5 hosts_access'

# for information on rule syntax.

# See 'man tcpd' for information on tcp_wrappers #

sshd:49.234.62.76:deny

sshd:218.122.198:deny sshd:159.89.238.247:deny sshd:49.235.156.117:deny sshd:51.83.41.120:deny sshd:121.228.255.99:deny