Windows 開不同的 ssh port
進 PS
powershell
確認 OpenSSH Server 正在運行
Get-Service -Name sshd
依照已有內容,把 Port 改成 22222
nano C:\ProgramData\ssh\sshd_config
重新啟動 OpenSSH Server
Restart-Service -Name sshd
加入防火牆規則(要開才會通,預設22不用開)
New-NetFirewallRule -Name sshd -DisplayName "OpenSSH Server (Port 22222)" -Enabled True -Protocol TCP -Direction Inbound -Action Allow -LocalPort 22222
應該要看到下面內容
Name : sshd
DisplayName : OpenSSH Server (Port 22222)
Description :
DisplayGroup :
Group :
Enabled : True
Profile : Any
Platform : {}
Direction : Inbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : 已從存放區成功剖析規則。 (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
RemoteDynamicKeywordAddresses : {}
PolicyAppId :
如果加錯的話,刪除再加一次防火牆規則
Remove-NetFirewallRule -Name sshd
留言
張貼留言