1)編輯 /etc/ssh/sshd_config
代碼: 選擇全部
Port 1122
AddressFamily inet
ListenAddress 0.0.0.0
代碼: 選擇全部
ssh 1122/tcp # The Secure Shell (SSH) Protocol
ssh 1122/udp # The Secure Shell (SSH) Protocol
- 編輯 /etc/firewalls/service/ssh.xml
代碼: 選擇全部
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>ssh</short>
<description>sshd server</description>
<port protocol="tcp" port="1122"/>
<port protocol="udp" port="1122"/>
</service>
- 打開防火牆的 SSH Port
代碼: 選擇全部
sudo firewall-cmd --add-rich-rule="rule family="ipv4" source address="yourClientIP" service name="ssh" accept" --permanent
4)讓 seLinux 認識定義的 port
代碼: 選擇全部
sudo semanage port -a -t ssh_port_t -p tcp 1122
代碼: 選擇全部
sudo dnf install policycoreutils-python-utils
代碼: 選擇全部
$ ssh UserName@HostIP -p 1122