windows ssh server

系統管理員開powershell

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

啟動SSH

Start-Service sshd

Set-Service -Name sshd -StartupType ‘Automatic’

如果有開windows的防火牆

Get-NetFirewallRule -Name *ssh*

New-NetFirewallRule -Name sshd -DisplayName ‘OpenSSH Server (sshd)’ -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

應用的話, 配上putty的plink

plink.exe -ssh username@host -pw password -m script.tmp

plink.exe -ssh username@host -pw password “./myscript.sh %1”

plink -ssh username@hotst -pw password “shutdown -r /t 0”

發佈留言