当前位置:网站首页>Windwos10安装sshd服务
Windwos10安装sshd服务
2022-06-29 10:57:00 【识途老码】
Windwos10安装sshd服务
安装openssh套件和ssh-copy-id
# 安装openssh和ssh-copy-id
choco install openssh ssh-copy-id -y
启动sshd服务
# 进入sshd目录
cd "C:\Program Files\OpenSSH-Win64"
# 执行install-sshd.ps1脚本
.\install-sshd.ps1
# 重启sshd服务
Restart-Service sshd
# 重启ssh-agent服务
Restart-Service ssh-agent
# 查看ssh服务和ssh-agent服务是否运行
Get-Service ssh
Get-Service ssh-agent
# 查看22端口是否处于监听状态
netstat -ano|grep 22
# telnet测试本地22端口是开放
telnet 127.0.0.1 22
配置Win10的sshd服务–免密登录
ssh的配置文件在C:\ProgramData\ssh\sshd_config
vim C:\ProgramData\ssh\sshd_config
# 非常重要
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no #(需要将默认的yes改为no,很重要)
注释文件最后几行
#Match Group administrators
#AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
修改完配置一定要重启sshd服务
Restart-Service sshd
设置ssh登录后默认的shell
设置shell为powershell
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
设置shell为pwsh7
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force
配置密钥免密登录
# 生成密钥对
ssh-keygen
# 将私钥加载到ssh-agent
ssh-add ~\.ssh\id_rsa
scp上传公钥到ssh服务器
# 上传私钥到ssh服务器
scp C:\Users\username\.ssh\id_rsa.pub [email protected]@contoso.com:C:\Users\username\.ssh\authorized_keys
ssh-copy-id上传公钥到ssh服务器
ssh-copy-id没成功,报错umask问题
ssh-copy-id [email protected]
ssh登录Windows-sshd服务器
ssh [email protected]
边栏推荐
- ruoyi框架中添加sharding sphere5.0.0分表(通过spi添加自定义分表策略)
- CICD简介[通俗易懂]
- Discussion on QT learning 10 message processing in QT
- 启泰观察:职业精英创业必踩巨坑之 --- 学习效果坑
- 软件工程导论——第五章——总体设计
- When a technician becomes a CEO, what "bugs" should be modified?
- 高效远程办公的基石:有效沟通 |社区征文
- equals提高执行速度/性能优化
- Adding sharding sphere5.0.0 sub tables to the ruoyi framework (adding custom sub table policies through SPI)
- 重建中国科研自信——2022最新自然指数排行榜(Nature Index 2022 )公布,中国的研究产出增幅最大...
猜你喜欢

Today in history: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born

Babbitt | yuancosmos daily must read: HTC announced the launch of the first yuancosmos mobile phone, which costs about 2700 yuan. What are the new ways to play

跟着官方学电机,BLDC两种控制策略,学到即赚到

Qt学习03 Qt的诞生和本质
![Leetcode 535 encryption and decryption of tinyurl [map] the leetcode road of heroding](/img/76/709bbbbd8eb01f32683a96c4abddb9.png)
Leetcode 535 encryption and decryption of tinyurl [map] the leetcode road of heroding

美创入选信通院“业务安全推进计划”首批成员单位

申请uniapp离线打包时的AppKey

Self-Improvement! Junior college "counter attack" master of Zhejiang University, 3 SCI, and finally become a doctor of Tsinghua University!

Exclusive interview with CTO: the company has deepened the product layout and accelerated the technological innovation of domestic EDA

Information technology application and innovation professionals (database) intermediate training hot enrollment (July 6-10)
随机推荐
Pytorch - 分布式通信原语(附源码)
Introduction to software engineering - Chapter 5 - overall design
When a technician becomes a CEO, what "bugs" should be modified?
记一次 MSI 笔记本 GE63 播放网页视频 闪屏和随机发绿 问题解决
在日本的 IT 公司工作是怎样一番体验?
ETL为什么经常变成ELT甚至LET?
(JS) pure function in array
rxjs Observable 设计原理背后的 Pull 和 Push 思路
专访 SUSS NiFT 负责人:Web3 的未来离不开“人人为我,我为人人”的治理
MySQL 索引失效的几种类型以及解决方式
又拍云 Redis 的改进之路
Safety innovation practice | Haitai Fangyuan was invited to participate in the technical exchange Seminar on "network information innovation and value co creation in the digital age"
MMdet的Resnet卷积替换成Ghost卷积组所出现的问题
The use of Fibonacci sequence and bubble sort in C language
【VTK】MFC基于VTK8.2的网格编辑器
【高并发】缓存思路
mysql 1146错误[通俗易懂]
Qt学习03 Qt的诞生和本质
基于鲲鹏开发套件实现x86平台到Kunpeng平台的源码迁移【玩转华为云】
X-FRAME-OPTIONS web page hijacking vulnerability