Linux prohibits the root user from logging directly into sshd and modifies the default port

Source: Internet
Author: User
Tags server port
  • Linux highest-Privileged user root, which can be directly logged into sshd by default. In order to improve the security of the server, it is necessary to prohibit it, so that the attacker can not be brute force to gain root privileges.

1, create a new user;

#useradd xxx (XXX for you to create a new username)

2, set the password for the new user;

#passwd xxx (XXX for you to create a new username)

3, modify sshd configuration, disable root direct login

#vi/etc/ssh/sshd_config

Look for "#PermitRootLogin yes", remove the previous "#", and the short tail "yes" to "No" and save the file.

4, after the modification, restart the sshd service

#service sshd Restart

5, the next login, first use the xxx login, and then through the SU root to obtain root privileges.

  • Modifying the sshd default port

Although changing a port does not fundamentally protect against port scanning, it can improve defense to some extent.

1. Open the sshd configuration file

#vi/etc/ssh/sshd_config

2. Locate the #port 22 field to delete # and change the 22 to another unused port

Server port can be up to 65536 maximum

3. Restart the SSHD service

#service sshd Restart

4. Don't forget to change the port settings on the login tool.

Linux prohibits the root user from logging directly into sshd and modifies the default port

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.