Linux CentOS 7.*允許或禁止root使用者ssh遠端登入,並將22埠更新為11111
阿新 • • 發佈:2018-11-13
1)vim /etc/ssh/sshd_config
,將PermitRootLogin的值改成no,並儲存
PermitRootLogin yes更改為no
重啟ssh
systemctl restart sshd
禁止登入了, 否則就能登入
2)修改埠
2.1)基礎
啟動: systemctl start firewalld
檢視狀態: systemctl status firewalld
停止: systemctl disable firewalld
禁用: systemctl stop firewalld
檢視所有開啟的埠: firewall-cmd --zone=public --list-ports
2.2 基本操作
新增11111埠
firewall-cmd --zone=public --add-port=11111/tcp --permanent (--permanent永久生效,沒有此引數重啟後失效)
重新載入
firewall-cmd --reload
檢視
firewall-cmd --zone=public --query-port=11111/tcp
刪除
firewall-cmd --zone=public --remove-port=22/tcp --permanent