Centos prohibits the root account from directly logging on

Source: Internet
Author: User

The default Administrator name in Linux is root. You only need to know the ROOT password to directly log on to SSH. Preventing Root users from logging on directly from SSH improves server security. After performing the following operations.

This article applies to CentOS, Debian, and other Linux systems.


1. Create an account
Useradd kwxgd

Run the preceding commands in SSH to create an account named "kwxgd", which can be customized.


Ii. Set the account password
Passwd kwxgd

Use the passwd command to set or change the password for the corresponding account.

As shown in the following figure, you need to enter the verification password twice to set or change the password. after entering the verification password, press enter to confirm.


3. Direct login by root is not allowed
1. Modify Related Files
Vi/etc/ssh/sshd_config

Run the preceding command in SSH to modify the sshd_config file.


2. Disable root Login

Find"# PermitRootLogin yes, remove "#" from the front, change "Yes" to "No" from the short tail, and save the file.



4. Next Login
1. Use the newly created account "kwxgd" to log in as a common user.
2. To obtain the ROOT permission, run the following command in SSH:
Su root

Run the preceding command and enter the root password to obtain the root permission.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.