阿里雲centos7 6修改ssh埠

2021-10-23 04:06:09 字數 1406 閱讀 6289

sysctl -a | grep ip_local_port_range
顯示:net.ipv4.ip_local_port_range = 32768 60999

新ssh埠號選擇在這個範圍內即可,如32665

vi etc/ssh/sshd_config
在增加port埠32665儲存之後

重啟一下

systemctl restart sshd
yum安裝一下

yum provides semanage

yum -y install policycoreutils-python

新增新埠32665

檢測一下是否成功

semanage port -l | grep ssh
返回值出現22和32665即為成功。

首先檢測防火牆是否已經啟用,啟用返回值runing,反之,為not running

firewall-cmd --state
若沒有啟用,需要啟用

systemctl start firewalld

systemctl enable firewalld

檢視防火牆的預設、活躍區域(zones)

firewall-cmd --get-default-zone

firewall-cmd --get-active-zones

為了防止出錯,22埠一同開放

與臨時開放的區別在於多了permanent

firewall-cmd --permanent --zone=public --add-port=22/tcp

firewall-cmd --permanent --zone=public --add-port=32665/tcp

防火牆重啟

firewall-cmd --reload
檢視已暴露埠

firewall-cmd --permanent --list-port

firewall-cmd --zone=public --list-all

systemctl restart sshd.service
然後用xshell測試一下,如果沒有成功看看阿里雲的埠開放沒有

阿里雲centOS7 6安裝git

1.檢視是否已經安裝了git,未出現版本資訊,繼續安裝 git vesion2.安裝相關環境 sudo yum install curl devel expat devel gettext devel openssl devel zlib devel gcc perl extutils makema...

Centos7 6修改網絡卡名稱

centos7.6修改網絡卡名稱 1.修改網絡卡配置檔案名稱 建議備份配置檔案 root 192 cd etc sysconfig network scripts cp a ifcfg ens32 ifcfg eth0 備份配置檔案 root 192 network scripts mv ifcfg...

centos7 6 更換核心

目標 私有的module在某個版本上出現了問題,需要借助核心本身的工具來幫助除錯這個問題,所以我的目標僅僅是開啟某些除錯選項來除錯問題.所以原始碼仍然選擇了centos release的.國內有一些知名的源,它會和centos的源 進行同步,而因為處於國內,速度非常快。推薦使用tuna 清華 163...