Linux server SSH cracking prevention method (recommended)

Linux server SSH cracking prevention method (recommended)

1. The Linux server configures /etc/hosts.deny to prohibit the other party's IP from logging into my server via SSH

vim /etc/hosts.deny

2. Do not use the default port 22 of the SSH service. Reset a new port. It is best to set a new port number greater than 1024.

First, log in to the Alibaba Cloud console and open a new port on your server;

Then, modify the SSH configuration file on the server, add a line of Port 1618 to the file and save and exit (:wq)

vim /etc/ssh/sshd_config

Each time you change the SSH service configuration, you need to restart the SSH service.

service sshd restart

3. Do not give the other party the opportunity to crack by brute force. Delete common users such as admin. The other party cannot guess the username and cannot brute force the password (userdel -r means complete deletion without retaining the user's file information)

userdel -r admin

4. Prohibit the root user from logging in via SSH, because the default superuser name of the server is root, and the other party has the opportunity to brute force the password with the root username. If the password is successfully cracked, the damage caused by having root privileges is too great, especially in a production environment. Therefore, you can do this, log in to SSH with other users, and use su - to switch back to the root user if necessary

vim /etc/ssh/sshd_config

Change the line PermitRootLogin yes to PermitRootLogin no

5. The user password for logging into SSH should be as complex as possible.

Summarize

The above is the Linux server SSH cracking prevention method introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Tutorial on configuring SSH and Xshell to connect to the server in Linux (with pictures)
  • How to set up ssh password-free login to Linux server
  • Install OpenSSH on Windows and log in to the Linux server by generating an SSH key
  • How to upload files and folders to Linux server via SSH
  • Paramiko module under Python implements ssh connection to log in to Linux server
  • Using winscp and batch processing under Windwos to upload files to Linux server through SSH port
  • Four tips for configuring secure SSH access on Linux servers
  • Linux ssh server configuration code example

<<:  Implementation of Vue package size optimization (from 1.72M to 94K)

>>:  Install MySQL 5.7.17 in win10 system

Recommend

JavaScript canvas to achieve scratch lottery example

This article shares the specific code of JavaScri...

HTML Basics: The basic structure of HTML

The basic structure of HTML hypertext documents is...

Vue achieves seamless carousel effect

This article shares the specific code of Vue to a...

A brief analysis of the function calling process under the ARM architecture

Table of contents 1. Background knowledge 1. Intr...

MySQL transaction analysis

Transaction A transaction is a basic unit of busi...

MySQL query method with multiple conditions

mysql query with multiple conditions Environment:...

JavaScript realizes the drag effect of modal box

Here is a case of modal box dragging. The functio...

Implementation of CSS border length control function

In the past, when I needed the border length to b...

Vue codemirror realizes the effect of online code compiler

Preface If we want to achieve the effect of onlin...

React antd tabs switching causes repeated refresh of subcomponents

describe: When the Tabs component switches back a...

How to export and import .sql files under Linux command

This article describes how to export and import ....

Example of how to deploy a Django project using Docker

It is also very simple to deploy Django projects ...