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 set up the linux system to log in to ordinary users first, and then transfer to root users

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Modify / etc/sudoers, find the following line, and add an ordinary user, such as user abc, under root (provided that the abc user already exists and the password is set):

Allow root to run any commands anywhere

Root ALL= (ALL) ALL

Abc ALL= (ALL) ALL

2. It means that the user is allowed to be given the same permission as root to execute any command anywhere.

3. Edit the configuration file of ssh, find the following line, change yes to no, and prohibit root users from logging in:

Vi / etc/ssh/sshd_config

# PermitRootLogin yes

PermitRootLogin no

4. After the above simple configuration, you can disable root login. After logging in to the machine with ordinary user abc, if you want to switch to root, then use the su command to switch to root:

Su root

Then enter the corresponding password according to the prompt

5. It is recommended to disable root login in ssh to avoid being cracked; in addition, modify the default port 22 of ssh, or add ssh whitelist to protect the server.

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

Servers

Wechat

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

12
Report