<?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>Too many authentication failures &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/too-many-authentication-failures/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Tue, 10 Aug 2021 17:33:50 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] ssh连接Linux服务器时提示&quot;Too many authentication failures&quot;的解决办法</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-ssh%e8%bf%9e%e6%8e%a5linux%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%97%b6%e6%8f%90%e7%a4%batoo-many-authentication-failures%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-ssh%e8%bf%9e%e6%8e%a5linux%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%97%b6%e6%8f%90%e7%a4%batoo-many-authentication-failures%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sun, 08 Aug 2021 19:01:27 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[Too many authentication failures]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=13327</guid>

					<description><![CDATA[<div>
	如果你用&#160;<span style="color:#0000ff;">用户名+密码</span> 的方式第一次ssh连接一台Linux服务器，连不上并且报以下错误：</div>
<blockquote>
<div>
		Received disconnect from xxx.xxx.xxx.xxx port 22:2: Too many authentication failures</div>
<div>
		Disconnected from xxx.xxx.xxx.xxx port 22</div>
</blockquote>
<div>
	如果你确定不是因为你输入了太多次错误密码，那么产生这个问题的一个可能原因是：<br />
	在发起连接的机器（<span style="color:#ff0000;">记为A</span>）的 ~/.ssh&#160;目录下放了太多密钥文件，当你连接一台新的服务器并且没有在 ~/.ssh/config&#160;文件中做过特殊的配置时，默认会挨个尝试所有密钥文件，而这些密钥文件，都不是适配那台新服务器的，所以会连接失败。<br />
	<span id="more-13327"></span><br />
	解决这个问题的办法有两种：<br />
	（1）仍然要使用&#160;用户名+密码&#160;的方式登录目标服务器，加&#8220;<span style="color:#0000ff;">PubkeyAuthentication=no</span>&#8221;参数来指定不使用密钥文件
<blockquote>
<p>
			ssh -o PubkeyAuthentication=no root@192.168.15.16</p>
</blockquote>
<p>
	（2）配置使用密钥文件、无密码登录目标服务器<br />
	*&#160;使用另一台机器先登录上目标服务器，按<a href="https://www.codelast.com/?p=10117" rel="noopener" target="_blank"><span style="background-color:#faebd7;">这篇</span></a>文章的做法，把它配置成可以无密码登录服务器。<br />
	*&#160;在A机器上，编辑 ~/.ssh/config&#160;文件，添加如下配置：</p>
<blockquote>
<div>
			Hostname xxx.xxx.xxx.xxx</div>
<div>
			User your_user_name</div>
<div>
			Port 22</div>
<div>
			IdentitiesOnly=yes</div>
<div>
			IdentityFile ~/.ssh/id_rsa_xxx</div></blockquote></div>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-ssh%e8%bf%9e%e6%8e%a5linux%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%97%b6%e6%8f%90%e7%a4%batoo-many-authentication-failures%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<div>
	如果你用&nbsp;<span style="color:#0000ff;">用户名+密码</span> 的方式第一次ssh连接一台Linux服务器，连不上并且报以下错误：</div>
<blockquote>
<div>
		Received disconnect from xxx.xxx.xxx.xxx port 22:2: Too many authentication failures</div>
<div>
		Disconnected from xxx.xxx.xxx.xxx port 22</div>
</blockquote>
<div>
	如果你确定不是因为你输入了太多次错误密码，那么产生这个问题的一个可能原因是：<br />
	在发起连接的机器（<span style="color:#ff0000;">记为A</span>）的 ~/.ssh&nbsp;目录下放了太多密钥文件，当你连接一台新的服务器并且没有在 ~/.ssh/config&nbsp;文件中做过特殊的配置时，默认会挨个尝试所有密钥文件，而这些密钥文件，都不是适配那台新服务器的，所以会连接失败。<br />
	<span id="more-13327"></span><br />
	解决这个问题的办法有两种：<br />
	（1）仍然要使用&nbsp;用户名+密码&nbsp;的方式登录目标服务器，加&ldquo;<span style="color:#0000ff;">PubkeyAuthentication=no</span>&rdquo;参数来指定不使用密钥文件</p>
<blockquote>
<p>
			ssh -o PubkeyAuthentication=no root@192.168.15.16</p>
</blockquote>
<p>
	（2）配置使用密钥文件、无密码登录目标服务器<br />
	*&nbsp;使用另一台机器先登录上目标服务器，按<a href="https://www.codelast.com/?p=10117" rel="noopener" target="_blank"><span style="background-color:#faebd7;">这篇</span></a>文章的做法，把它配置成可以无密码登录服务器。<br />
	*&nbsp;在A机器上，编辑 ~/.ssh/config&nbsp;文件，添加如下配置：</p>
<blockquote>
<div>
			Hostname xxx.xxx.xxx.xxx</div>
<div>
			User your_user_name</div>
<div>
			Port 22</div>
<div>
			IdentitiesOnly=yes</div>
<div>
			IdentityFile ~/.ssh/id_rsa_xxx</div>
</blockquote>
<div>
		其中，xxx.xxx.xxx.xxx&nbsp;是目标服务器的IP地址，your_user_name&nbsp;是登录目标服务器的用户名，id_rsa_xxx&nbsp;是用于无密码登录目标服务器的密钥文件。<br />
		<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
		配置好之后，再连接目标服务器就不再出错了。</p>
<p>		<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
		转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
		感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
			<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-ssh%e8%bf%9e%e6%8e%a5linux%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%97%b6%e6%8f%90%e7%a4%batoo-many-authentication-failures%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
