Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to prevent root users from logging in directly by Linux

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of Linux how to prohibit root users from logging in directly, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will gain something after reading this Linux article on how to prohibit root users from logging in directly. Let's take a look.

Root, the most privileged user in Linux, can log in to sshd directly by default. In order to improve the security of the server, it needs to be disabled to make it impossible for attackers to obtain root privileges through brute force cracking.

New user [root@CentOS ~] # useradd test configure password # use the passwd command to set or change the password for the corresponding account. [root@CentOS ~] # passwd test# according to the figure, you need to enter the password twice to set or modify the password, and the second time is the valid password. Please enter and confirm after entering. Changing password for user test.New password:Retype new password:passwd: all authentication tokens updated successfully. Configuration does not allow root users to directly log in and modify related files vi / etc/ssh/sshd_config forbids root login search # PermitRootLogin yes "defaults to line 132. remove" # ", end" Yes "to" No "and wq saves and restarts sshd service systemctl restart sshd test connection

You can see that directly using root to connect to the server ssh will directly reject:

Normal connection mode

Log in to the ordinary user first using the ssh connection, and then use su-Log in to the root user after logging in to the ordinary user.

This is the end of the article on "how Linux prohibits root users from logging in directly". Thank you for reading! I believe that everyone has a certain understanding of "how Linux forbids root users to log in directly". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report