Modify SSH ports and disable root telnet under Linux

Source: Internet
Author: User
Tags ssh port

Modify SSH ports and disable root telnet under Linux

As we all know, SSH default port number is 22, to change the port number is 9688, need to edit/etc/ssh/ssh_config and/etc/ssh/sshd_config two files can;
To disable root login, you need to edit the/etc/ssh/sshd_config. (Some Linux directories may be/etc/sshd, please modify according to the actual situation)

The procedure is as follows:

1. Edit the/etc/ssh/ssh_config file:

[Email protected] ~]# cat/etc/ssh/ssh_config |grep Port
Port 9688

Remove the comment symbol "#" that was commented out before Port 22 and change the 22 to 9688 as above to save the exit.

2. Edit the/etc/ssh/sshd_config file:

#vim/etc/ssh/sshd_config

Find Permitrootlogin, change the following yes to No, so root cannot log in remotely, save exit.

3. Restart SSH:

#/etc/init.d/ssh restart

This successfully changes the SSH port number and disables root telnet. It is worth mentioning that if you have only the root user in Linu x, you must establish a new user before shutting down root telnet, otherwise you will not be able to log on to the server using SSH!

The contents of this article are tested under Ubuntu, and the commands in other Linux systems are similar.

Modify SSH ports and disable root telnet under Linux

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.