除 RDP 外,OpenSSH 为 Windows VPS 提供 SSH/SFTP 管理。
📋 前提条件
- 具有管理员权限的 Windows Server;如需放行 22 端口见防火墙。
安装功能
管理员 PowerShell:
PowerShellGet-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*' Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
启动服务
PowerShellStart-Service sshd Set-Service -Name sshd -StartupType Automatic Get-Service sshd
Windows 防火墙
规则通常会自动创建,否则:
PowerShellNew-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH Server (TCP 22)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
从本机测试
替换 VPS_IP 与 Windows 用户名:
Bashssh utilisateur@IP_DU_VPS
SFTP : sftp utilisateur@IP_DU_VPS
安全
- 优先使用 SSH 密钥
- 限制允许账户
- 配合初始配置与更新
祝使用顺利!🚀