1、确认电脑是否安装OpenSSH
1.1、Windows+R 打开运行框
1.2、输入:powershell
powershell
1.3、管理员进入Shell
1.4、确认安装情况
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
2、安装OpenSSH
2.1、安装OpenSSH客户端
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
2.2、安装OpenSSH服务端
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
3、设置OpenSSH服务
3.1、开启服务
Start-Service sshd
3.2、配置开机自启
Set-Service -Name sshd -StartupType 'Automatic'
3.3、防火墙放行SSH
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
4、测试验证
ssh 127.0.0.1
5、切换盘符&查看目录
e:
dir
6、卸载OpenSSH
6.1、卸载OpenSSH客户端
Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
6.2、卸载OpenSSH服务端
Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
7、提醒
8、远控电脑方案
8.1、安装贝锐花生壳软件
点击下载:贝锐花生壳
使用指南:花生壳配置快速上手指南