记录Windows下Jenkins安装后,OpenSSH安装

185 阅读1分钟

1. 安装文件

下载地址:openssh.en.softonic.com/download

百度网盘链接:pan.baidu.com/s/1Egypdyr8… 提取码:6hst

2. 解压到C:\Program Files并重命名为OpenSSH  

3. 启动Window PowerShell 并进入C:\Program Files\OpenSSH目录

cd 'C:\Program Files\OpenSSH'

4. 输入命令安装sshd和ssh-agent服务

powershell -ExecutionPolicy Bypass -File install-sshd.ps1

5. 打开防火墙,开启22端口 (也可使用控制面板中防火墙 高级 进行设置)   

netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22

6. 设置开机启动

Set-Service sshd -StartupType Automatic

Set-Service ssh-agent -StartupType Automatic

  7. 设置配置文件(C:\ProgramData\ssh中sshd_config)  启动服务会自动产生 复制其他环境的配置文件过来

PasswordAuthentication  yes

RSAAuthentication yes

PubkeyAuthentication yes

PermitRootLogin yes

8. 启动服务

Start-Service sshd

Start-Service ssh-agent

 

9. winscp 账号密码连接,生成并发送秘钥到服务器

image.png  

image.png

image.png

image.png

image.png

10. 测试秘钥连接,连接成功关闭密码登录设置配置文件(C:\ProgramData\ssh中sshd_config)  

PasswordAuthentication  no   保存重启ssh服务

 

11.jenkins添加配置  注意以下,已踩坑

image.png