Linux Change SSH port

Source: Internet
Author: User
Tags server port ssh port

The default remote management port for Windows Server is the default port for the 3389,linux server is 22. If you are on the public web, you will often be swept by the tool, which is not safe, for system security, you need to change the default configuration.

The following is an example of the operation process in Centos6.5:

[[email protected] ~]# Cp/etc/ssh/sshd_config/etc/ssh/sshd_config.ori change pre-configuration backup [[email protected] ~]# Vi/etc/ssh/sshd_c Onfig Edit sshd_config### #by zdw#2016-4-11## Add the following: Port 52113PermitRootLogin NOPERMITEMPTYPASSW Ords nousedns nogssapiauthentication no### #by zdw#2016-4-11##

Parameter description:

Parameters Description
Port

Specifies the port number that the sshd daemon listens on, which defaults to 22. The default is to listen on all network interfaces on this computer, or you can specify only on a specific interface by listenaddress.

Port range: 0-65535, cannot conflict with an existing server port.

Permitrootlogin Whether to allow root login. The available values are: "Yes" (default), "No" means no, "without-password" means no password authentication is allowed; "Forced-commands-only" Indicates that a public key authentication login is allowed only if the command option is specified, while the other authentication methods are all banned, and this value is often used to do things like remote backup
Permitemptypasswords Whether to allow users with blank passwords to log on remotely. Default to "No"
Usedns

Specifies whether sshd should reverse-parse the remote host name to check if this hostname corresponds to its IP address. The default value is "Yes".

Suggest change to "no", otherwise it may cause SSH connection to be slow

Gssapiauthentication No Solve the problem of slow remote connection between Linux using SSH
When the above modifications are complete, save to exit.

Perform the following command to restart sshd for the configuration to take effect:

[[email protected] ~]# /etc/init.d/sshd reloadreloading sshd:                                               [  ok  ][[email protected] ~]# /etc/init.d/sshd  restartStopping sshd:                                               [  OK   ]Starting sshd:                                      &nbSP;        [  OK  ] 

Note: Reload is a smooth restart and does not affect other users who are SSH connected, so it is better than restart.

At this point, the root user is no longer able to log on, using ZDW users to log on by 52113.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/DA/wKioL1cLIA6jgjOlAAFa15VGTkc190.jpg "title=" Qq20160411115040.jpg "alt=" Wkiol1clia6jgjolaafa15vgtkc190.jpg "/>

[Email protected] ~]$ whoamizdw[[email protected] ~]$ su-rootpassword: [[email protected] ~]# Whoamiroot


Reference:

Old boy Linux

http://oldboy.blog.51cto.com/2561410/1300964


This article is from the blog "Write to Yourself", so be sure to keep this source http://zhaodongwei.blog.51cto.com/4233742/1762544

Linux Change SSH 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.