centos7更改ssh端口號

編輯sshd配置文件 增長port 6800python

vi /etc/ssh/sshd_config

重啓sshdbash

systemctl restart sshd

添加端口到防火牆ssh

firewall-cmd --zone=public --add-port=6800/tcp --permanent
查詢是否添加成功
firewall-cmd --query-port=6800/tcp

打開SELINUX端口tcp

要用到semanage工具,若是沒有安裝能夠工具

yum -y install net-tools
yum -y install policycoreutils-python

打開2800端口rest

semanage port -a -t ssh_port_t -p tcp 6800

查看2800端口是否打開code

semanage port -l | grep ssh

若是一切正常,SSH客戶端用6800端口進行登陸後,能夠刪除22端口,重啓sshdcmd

systemctl restart sshd
相關文章
相關標籤/搜索