VPS Modify SSH Login Port and Disable ROOT Login Method

  

Modify SSH Login Port

Modify File: /etc/ssh/sshd_config

Port 22 #On the third or fourth OK, if there is a pound sign in front, please delete it, modify it to 65534 or less.

You can use the vi command in the remote connection, or sftp to download it locally. After modification, use the following command to restart the ssh service

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

/etc/init.d/ssh restart#debian/ubuntu system, restart ssh service command

Forbidden ROOT login

More secure settings, use small login and switch ROOT (this method can't upload files with SFTP)

useradd yzgod#Create a new trumpet

Passwd yzgod# set the password for the trumpet, you need to enter the exact same twice, pay attention to the prompt

vi /etc/ssh/sshd_config# modified file or this

PermitRootLogin yes# put yes, Change to no, save and exit, and restart the SSH service (there are restart commands on it)

Remember if There are new trumpet, trumpet or password is set incorrectly, you have the ban ROOT, you can reboot the system or a snapshot rollback, could no longer log in.

If you don't need a secure environment and you need to use SFTP to manage files, then you can change the port.

Copyright © Windows knowledge All Rights Reserved