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
- <Prename = "code" class = "plain"> sudofirewall-cmd -- list-ports
Open Port:
[Plain] view plaincopy
- 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