Modify SSH port for CentOS VM instance security and disable ROOT login

Source: Internet
Author: User
Tags ssh port

Modify SSH port for CentOS VM instance security and disable ROOT login

In fact, Linux is safe, but if the password is not complex enough, if the lower case + number is 12 digits in total, your SSH uses the default port, A powerful hacker can crack your password in less than half an hour. Therefore, the best way is to modify the SSH port.

1. Modify the file:/etc/ssh/sshd_config

Port 22# In row 3 or Row 4, if there is a well number in front of it, delete it and change it to below 65534.

You can use the vi command or sftp command to download the modification to the local device for remote connection. After modification, use the following command to restart the ssh service.

/etc/init.d/sshd restart# Centos system, restart the ssh service command

/etc/init.d/sshrestart# Debian/ubuntu system, restart the ssh service command

2. More Secure Settings: Prohibit ROOT login, use the account to log on and then switch to ROOT (this method cannot use SFTP to upload files)

useraddvpsmm# Create a new account

passwdvpsmm# Set the password for the account number. Enter the same password twice. Note that

vi/etc/ssh/sshd_config# This is the modified file.

PermitRootLoginyes# Change "yes" to "no", save and quit, and restart the SSH service (the restart command is shown above)

Remember, if you have not created a new account or the account password is incorrectly set, and you have disabled ROOT, you can only restart the system or roll back the snapshot, and you can no longer log on.
If you do not need a secure environment and want to use SFTP to manage files, you can just change the port.

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.