<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>惜分飞 &#187; win ssh免密登录</title>
	<atom:link href="https://www.xifenfei.com/tag/win-ssh%e5%85%8d%e5%af%86%e7%99%bb%e5%bd%95/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Thu, 29 Oct 2026 15:31:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>配置win环境ssh和sftp并实现免密登录</title>
		<link>https://www.xifenfei.com/2024/07/openssh-install-config.html</link>
		<comments>https://www.xifenfei.com/2024/07/openssh-install-config.html#comments</comments>
		<pubDate>Sun, 21 Jul 2024 10:29:05 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[操作系统]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[win sftp]]></category>
		<category><![CDATA[win ssh]]></category>
		<category><![CDATA[win ssh免密登录]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=10850</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2024/07/openssh-install-config.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2024/07/openssh-install-config.html" target="_blank">配置win环境ssh和sftp并实现免密登录</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>在某些情况下,需要在win环境中安装ssh,sftp等服务,可以考虑通过安装OpenSSH,下载地址:<a href="https://github.com/PowerShell/Win32-OpenSSH/releases" title="OpenSSH" rel="noopener" target="_blank">https://github.com/PowerShell/Win32-OpenSSH/releases</a>,下载最新版OpenSSH-Win64.zip并解压<br />
<strong>openssh安装服务</strong></p>
<pre class="brush: bash; title: ; notranslate">
Microsoft Windows [版本 10.0.19045.3208]
(c) Microsoft Corporation。保留所有权利。

C:\Windows\system32&gt;cd E:\OpenSSH-Win64

C:\Windows\system32&gt;e:

E:\OpenSSH-Win64&gt;powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
  [*] E:\OpenSSH-Win64\moduli
Inheritance is removed from 'E:\OpenSSH-Win64\moduli'.
'NT AUTHORITY\Authenticated Users' now has Read access to 'E:\OpenSSH-Win64\moduli'.
'BUILTIN\Users' now has Read access to 'E:\OpenSSH-Win64\moduli'.
      Repaired permissions

  [*] C:\ProgramData\ssh
      looks good

[SC] SetServiceObjectSecurity 成功
[SC] ChangeServiceConfig2 成功
[SC] ChangeServiceConfig2 成功
sshd and ssh-agent services successfully installed
Updated Machine PATH to include OpenSSH directory, restart/re-login required to take effect globally

E:\OpenSSH-Win64&gt;net start sshd
OpenSSH SSH Server 服务正在启动 ..
OpenSSH SSH Server 服务已经启动成功。

E:\OpenSSH-Win64&gt;ssh -V
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
</pre>
<p><strong>设置服务为自动启动</strong><br />
<a href="https://www.xifenfei.com/wp-content/uploads/2024/07/openssh.jpg"><img src="https://www.xifenfei.com/wp-content/uploads/2024/07/openssh.jpg" alt="openssh" width="463" height="297" class="alignnone size-full wp-image-10851" /></a><br />
<hr />
也可以可以通过cmd命令设置:sc config sshd start= auto<br />
<br />
<strong>配置免密登录</strong><br />
1)修改C:\ProgramData\ssh\ssh_config文件</p>
<pre class="brush: bash; title: ; notranslate">
PubkeyAuthentication yes
AuthorizedKeysFile %programdata%/ssh/administrators_authorized_keys
</pre>
<p>2)拷贝C:\ProgramData\ssh\ssh_host_rsa_key为C:\ProgramData\ssh\administrators_authorized_keys<br />
3)下载ssh_host_rsa_key和ssh_host_rsa_key.pub文件，放到其他机器的C:\Users\用户名\.ssh目录中并重命名为id_rsa和id_rsa.pub<br />
<br />
<strong>测试其他机器免密ssh/sftp登录</strong></p>
<pre class="brush: bash; title: ; notranslate">
C:\Users\XFF&gt;ssh xifenfei@192.168.222.2
Microsoft Windows [版本 10.0.19045.3208]
(c) Microsoft Corporation。保留所有权利。

xifenfei@DESKTOP-3PQ0P6C C:\Users\xifenfei&gt;exit
Connection to 192.168.222.2 closed.

C:\Users\XFF&gt;sftp xifenfei@192.168.222.2
Connected to 192.168.222.2.
sftp&gt; pwd
Remote working directory: /C:/Users/xifenfei
</pre>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/08/%e5%9c%a8win-64%e4%bd%8d%e5%b9%b3%e5%8f%b0%e4%b8%8a%e8%bf%90%e8%a1%8cbbed%e6%94%af%e6%8c%81oracle-10g-11g-12c.html" rel="bookmark" class="crp_title">在win 64位平台上运行bbed(支持ORACLE 10g 11g 12c)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/04/oer-7451-in-load-indicator-error-code-osd-04500%e6%8c%87%e5%ae%9a%e4%ba%86%e9%9d%9e%e6%b3%95%e9%80%89%e9%a1%b9.html" rel="bookmark" class="crp_title">OER 7451 in Load Indicator : Error Code = OSD-04500:指定了非法选项</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2021/05/11-2-0-4-psu-service-not-start.html" rel="bookmark" class="crp_title">win 11.2.0.4打patch后服务无法正常启动处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2020/12/install-oracle-2-question.html" rel="bookmark" class="crp_title">记录oracle安装的两个小问题(INS-30060和弹出子窗口异常)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2022/07/ora-702_recovery-tool.html" rel="bookmark" class="crp_title">ORA-00702一键恢复工具</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/05/read_me_recover_tn-recovery.html" rel="bookmark" class="crp_title">read_me_recover_tn勒索恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/09/%e5%9c%a8win%e4%b8%ad%e8%bf%90%e8%a1%8cbbed%e7%a8%8b%e5%ba%8f.html" rel="bookmark" class="crp_title">在win中运行bbed程序</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2020/08/oracle-recovery-tools-202008.html" rel="bookmark" class="crp_title">Oracle Recovery Tools&#8212;202008</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/06/tns-12532-tns-12560-tns-00502.html" rel="bookmark" class="crp_title">tcp连接过多导致监听TNS-12532 TNS-12560 TNS-00502错误</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/11/ora-00494.html" rel="bookmark" class="crp_title">下调虚拟化资源导致ORA-00494</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2026/03/orafhr.html" rel="bookmark" class="crp_title">Oracle数据库被勒索加密一键open工具&#8211;OraFHR</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2019/09/win-rman-shared-directory.html" rel="bookmark" class="crp_title">rman备份到win共享目录</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2024/07/openssh-install-config.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
