CentOS How to disable root local or remote SSH login

Source: Internet
Author: User

In some special cases we need to prevent root from using SSH to log on locally or remotely to increase security. Below is a detailed description of how to disable root login.

  • Disable Root Local Login
  • Disable root remote SSH login
Disable Root Local Login

Modify the /etc/pam.d/login file to add the following line

auth required pam_succeed_if.so user != root quiet
Disable root remote SSH login

Modify the /etc/ssh/sshd_config file to

#PermitRootLogin yes

Revision changed to

PermitRootLogin no

Note the preceding # comment characters when modifying. Don't forget to restart the service at the same time sshd . Prohibit later, you can use the normal user login, after logging in if you need root permission, you can use su to switch to the root user. Or configure sudo the use of certain permissions for ordinary users root . This can increase the security of the system to some extent.

CentOS How to disable root local or remote SSH login

Related Article

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.