Modify sshd port in Centos 7

Source: Internet
Author: User

Modify sshd port in Centos 7

Modify the default SSHD Port and edit the sshd_config configuration file vi/etc/ssh/sshd_config to find Port 22, then, change port 22 to the commonly used commands of the Port Number vi you want, Press ESC to jump to the command mode, and then: w to save the file but do not exit vi: w file saves the changes to the file and does not exit vi: w! Force save, do not release vi: wq to save the file and exit vi: wq! Force save the file, and exit viq: Do not save the file, exit vi: q! Do not save the file, force exit vi: e! Discard all modifications and start editing the last saved file.
Centos 7 firewall command:

View opened ports:

[Html] view plaincopy
  1. <Prename = "code" class = "plain"> sudofirewall-cmd -- list-ports
 


Open Port:

[Plain] view plaincopy
  1. Sudofirewall-cmd -- zone = public -- permanent -- add-port = 922/tcp

 

If success is displayed, the instance is successfully added.

Command description:

-Zone # Scope

-Add-port = 80/tcp # add a port in the format of port/communication protocol

-Permanent # takes effect permanently. If this parameter is not set, it becomes invalid after restart.

Basic use of firewalld: start: systemctl start firewalld view status: systemctl status firewalld stop: systemctl disable firewalld disable: systemctl stop firewalld

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.