Enable sudo in centos6.6 and disable root remote logon.

Source: Internet
Author: User

By default, centos does not enable sudo and can directly log on to the server as a super administrator.

1. Add a sudo user

Run the mongodo command and find:

1 root    ALL=(ALL) ALL

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

1 sky9890 ALL=(ALL) ALL
# Note: You can add all permissions for the user here. The user added above has nothing to do with this experiment.

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:

In the configuration file "/etc/ssh/sshd_config", many items have been commented out by #, which is actually effective. Permitrootlogin was not found during the first experiment, and a permitrootlogin no was added. The result shows that the remote connection is indeed unable, and the added permitrootlogin is removed from the end #PermitRootLogin Yes. After sshd is restarted, you can connect remotely.


This article is from the "O & M" blog and will not be reproduced!

Enable sudo in centos6.6 and disable root remote logon.

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.