当前位置:网站首页>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]
边栏推荐
- LeetCode 535 TinyURL的加密与解密[map] HERODING的LeetCode之路
- MMdet的Resnet卷积替换成Ghost卷积组所出现的问题
- QT learning 11 string classes in QT
- Qt学习07 Qt中的坐标系统
- X-FRAME-OPTIONS web page hijacking vulnerability
- (JS) pure function in array
- Oracle netsuite helps TCM bio understand data changes and make business development more flexible
- How to identify the exact length and width of the contour
- 力扣(LeetCode)179. 最大数(2022.06.28)
- 又拍雲 Redis 的改進之路
猜你喜欢

Hit the industry directly! The first model selection tool in the industry was launched by the flying propeller

win11网页版

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

Meichuang was selected as one of the first member units of the "business security promotion plan" of the ICT Institute

How to identify the exact length and width of the contour

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

信息技术应用创新专业人员(数据库)中级培训火热招生中(7月6-10日)

Qt学习15 用户界面与业务逻辑的分离

Nature | 全球海洋微生物组的生物合成潜力

XML外部实体注入漏洞(一)
随机推荐
MySQL开启慢查询
稳定币风险状况:USDT 和 USDC 安全吗?
(JS) handwritten deep copy
MMdet中的Resnet源码解读+Ghost模块
2.8万字的Callable和Future面试知识点总结,看完我直接面进了字节跳动,原谅我有点飘了(下)
(JS) imitate the indexof method to find the position of a character in the string
(JS) pure function in array
Exclusive interview with CTO: the company has deepened the product layout and accelerated the technological innovation of domestic EDA
[daily 3 questions (3)] reformat the phone number
基础类型变量声明
(JS) array flat
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
Oracle netsuite helps TCM bio understand data changes and make business development more flexible
Uber前安全主管面临欺诈指控 曾隐瞒数据泄露事件
c# 键盘钩子
二叉树递归与迭代
Evaluation of IP location query interface Ⅱ
Qt学习10 初探 Qt 中的消息处理
Qt学习15 用户界面与业务逻辑的分离
[NLP] text generation topic 1: basic knowledge