[CENTOS] Setting to specify the IP allowed for SSH connection

When connecting to the server, the following message is displayed. ..

"There are xxx failed login attempts since the last correct login."

In my case, it was 60,000 times, so I was scared and decided to review the security immediately.

IP address specification permission

Allow connections for specific IPs

Edit the hosts.allow file

$vi /etc/hosts.allow

Original description

all: 127.0.0.1

Added content

sshd: xxx.xx.x.xx

IP address rejection

Deny connections from IPs other than those allowed

Edit the hosts.deny file

$vi /etc/hosts.deny

Original description

all: all

Added content

sshd: ALL


This is a solution. The login failure message is no longer displayed. Rest assured.

Reference site

-When specifying a global IP addressWhat are the hosts.allow file and hosts.deny file

Recommended Posts

Setting to specify the IP allowed for SSH connection
Try setting SSH (Exscript) from the software to the router
[Postgresql] SSH connection to the external DB server from the client
Log in to the remote server with SSH
How to use MkDocs for the first time
How to specify the NIC to scan with amazon-dash
Setting to output the log of cron execution
Specify the Python executable to use with virtualenv
I tried adding VPS to ConoHa ~ SSH connection
How to find the correlation for categorical variables
Try posting to Qiita for the first time