Enable sudo in CentOS and disable root remote logon.

Source: Internet
Author: User

Enable sudo in CentOS and disable root remote logon.

By default, CentOS does not enable sudo and can directly log on to the server as a super administrator. Ubuntu is better in this aspect. To ensure security and reduce the loss caused by misoperations, we recommend that you enable sudo.

1. Add a sudo user

Run the mongodo command and find:

1 Root ALL = (ALL) ALL

Add the following: (Note: qianyunlai is a new common user in Linux)

1 Qianyunlai ALL = (ALL) ALL

2. Prohibit root User Logon

Edit/etc/ssh/sshd_config and set

1 PermitRootLogin Yes

Change

1 PermitRootLogin no

Restart sshd:

1 Service sshd reload

Note:

Although many items are commented out by # in the configuration file "/etc/ssh/sshd_config", they are valid by default.

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.