安装
下载安装包:openssh
安装包解压至:C:\Program Files\OpenSSH-Win64,并进入到该文件夹
按Shift与鼠标右键,选择“在此处打开命令窗口”,然后输入下面指令:
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
启动服务
设置服务自动启动,继续执行下面命令:
sc config sshd start= auto
并启动服务,继续执行下面命令:
net start sshd
配置
随后会生成目录和配置,配置文件是:
C:\ProgramData\ssh\sshd_config
修改端口号
Port 22
修改后要重启服务
注意:修改配置文件后,需要重启 sshd 服务
修改其他配置
- 密钥访问:
PubkeyAuthentication yes - 密码访问:
PasswordAuthentication no - 空密码:
PermitEmptyPasswords no
客户端
ssh
使用:MobaXterm_Personal
sftp客户端
使用 WINSCP
不能使用:MobaXterm_Personal
参考:
https://blog.csdn.net/weixin_42819452/article/details/112982061