<?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>站点管理器 &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/%E7%AB%99%E7%82%B9%E7%AE%A1%E7%90%86%E5%99%A8/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Mon, 27 Apr 2020 17:35:57 +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>[原创] 配置iTerm2(MacOS)的&quot;站点管理器&quot;</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sat, 29 Feb 2020 16:27:04 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[iTerm2]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[站点管理器]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=11779</guid>

					<description><![CDATA[<p>
很多terminal client都有&#8220;站点管理器&#8221;功能，也就是说把服务器连接参数保存在配置里，用户可以通过在图形界面上点击的方式就能连接上指定的服务器，不再需要手工输入服务器IP、用户名、密码。<br />
SecureCTR，Xshell，ZOC等都有这种功能，但它们都不是免费软件。<br />
在MacOS上，ZOC算是一个功能很强大的terminal，但其价格也是贵得离谱（2019年的价格是将近80美元/单用户授权），而免费又最流行的terminal&#8212;&#8212;iTerm2，其对&#8220;站点管理器&#8221;的支持却不那么直接，需要经过一定的配置才能用起来，不过，就算是为了省那80美元，也值得我们花一些时间来配置一番，下面就走起来。<br />
<span id="more-11779"></span><br />
<span style="color:#ff0000;"><span style="background-color:#00ff00;">▶</span></span>&#160;分别为每个要连接的服务器创建一个profile<br />
在iTerm2主界面里按 <span style="color:#0000ff;">Command+O</span>&#160;快捷键打开&#8220;Profiles&#8221;对话框，如果你之前没有配置过的话，里面只会看到一个名为&#8220;<span style="color:#b22222;">Default</span>&#8221;的profile。不用管它，点击对话框下方的&#8220;<span style="color:#0000ff;">Edit Profiles...</span>&#8221;按钮：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/02/iterm2_edit_profiles_button.png" style="width: 446px; height: 194px;" /><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 />
会进入&#8220;<span style="color:#0000ff;">Preferences</span>&#8221;对话框：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_1.png" style="width: 300px; height: 541px;" /><br />
点击左下角的&#8220;+&#8221;，添加一个profile：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_2.png" style="width: 650px; height: 389px;" /><br />
其中，&#8220;Name&#8221;随便起一个名字即可；&#8220;Tags&#8221;可以为该服务器设置一个标签，相同标签的服务器可以有一个相同分组的概念；&#8220;Command&#8221;那里在下拉列表框里就选&#8220;Command&#8221;，并且在后面的文本框里填上：</p>
<blockquote>
<p>
		/Users/codelast/iterm-login.sh 22 codelast@abc.com&#160;my_login_password</p>
</blockquote>
<p>其中：<br />
<span style="color:#0000cd;">/Users/codelast/iterm-login.sh&#160;是一个配合登录用的脚本，后面接着会说到它。<br />
22是</span><span style="color:#b22222;">服务器ssh端口号</span><span style="color:#0000cd;">。<br />
codelast@abc.com&#160;是</span><span style="color:#b22222;">服务器ssh用户名</span><span style="color:#0000cd;">@</span><span style="color:#b22222;">服务器域名或IP</span><span style="color:#0000cd;">。<br />
my_login_password&#160;是</span><span style="color:#b22222;">登录服务器的密码</span><span style="color:#0000cd;">。</span><br />
以上内容根据实际情况更改。<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 />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);">▶</span></span>&#160;配合iTerm2使用的登录脚本<br />
iterm-login.sh&#160;脚本内容如下（内容来自网上，原链接不记得了，感谢作者）：&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>
很多terminal client都有&ldquo;站点管理器&rdquo;功能，也就是说把服务器连接参数保存在配置里，用户可以通过在图形界面上点击的方式就能连接上指定的服务器，不再需要手工输入服务器IP、用户名、密码。<br />
SecureCTR，Xshell，ZOC等都有这种功能，但它们都不是免费软件。<br />
在MacOS上，ZOC算是一个功能很强大的terminal，但其价格也是贵得离谱（2019年的价格是将近80美元/单用户授权），而免费又最流行的terminal&mdash;&mdash;iTerm2，其对&ldquo;站点管理器&rdquo;的支持却不那么直接，需要经过一定的配置才能用起来，不过，就算是为了省那80美元，也值得我们花一些时间来配置一番，下面就走起来。<br />
<span id="more-11779"></span><br />
<span style="color:#ff0000;"><span style="background-color:#00ff00;"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;分别为每个要连接的服务器创建一个profile<br />
在iTerm2主界面里按 <span style="color:#0000ff;">Command+O</span>&nbsp;快捷键打开&ldquo;Profiles&rdquo;对话框，如果你之前没有配置过的话，里面只会看到一个名为&ldquo;<span style="color:#b22222;">Default</span>&rdquo;的profile。不用管它，点击对话框下方的&ldquo;<span style="color:#0000ff;">Edit Profiles...</span>&rdquo;按钮：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/02/iterm2_edit_profiles_button.png" style="width: 446px; height: 194px;" /><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 />
会进入&ldquo;<span style="color:#0000ff;">Preferences</span>&rdquo;对话框：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_1.png" style="width: 300px; height: 541px;" /><br />
点击左下角的&ldquo;+&rdquo;，添加一个profile：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_2.png" style="width: 650px; height: 389px;" /><br />
其中，&ldquo;Name&rdquo;随便起一个名字即可；&ldquo;Tags&rdquo;可以为该服务器设置一个标签，相同标签的服务器可以有一个相同分组的概念；&ldquo;Command&rdquo;那里在下拉列表框里就选&ldquo;Command&rdquo;，并且在后面的文本框里填上：</p>
<blockquote>
<p>
		/Users/codelast/iterm-login.sh 22 codelast@abc.com&nbsp;my_login_password</p>
</blockquote>
<p>其中：<br />
<span style="color:#0000cd;">/Users/codelast/iterm-login.sh&nbsp;是一个配合登录用的脚本，后面接着会说到它。<br />
22是</span><span style="color:#b22222;">服务器ssh端口号</span><span style="color:#0000cd;">。<br />
codelast@abc.com&nbsp;是</span><span style="color:#b22222;">服务器ssh用户名</span><span style="color:#0000cd;">@</span><span style="color:#b22222;">服务器域名或IP</span><span style="color:#0000cd;">。<br />
my_login_password&nbsp;是</span><span style="color:#b22222;">登录服务器的密码</span><span style="color:#0000cd;">。</span><br />
以上内容根据实际情况更改。<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 />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;配合iTerm2使用的登录脚本<br />
iterm-login.sh&nbsp;脚本内容如下（内容来自网上，原链接不记得了，感谢作者）：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;"><span class="hljs-comment" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(128, 128, 128); word-wrap: inherit !important; word-break: inherit !important;">#!/usr/bin/expect&nbsp;-f

</span>

<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">set</span>&nbsp;timeout&nbsp;30
spawn&nbsp;ssh&nbsp;-p&nbsp;[lindex&nbsp;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); word-wrap: inherit !important; word-break: inherit !important;">$argv</span>&nbsp;0]&nbsp;[lindex&nbsp;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); word-wrap: inherit !important; word-break: inherit !important;">$argv</span>&nbsp;1]
expect&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;(yes/no)?&quot;</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{send&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;yes\n&quot;</span>;exp_continue}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;password:&quot;</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{send&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;[lindex&nbsp;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); word-wrap: inherit !important; word-break: inherit !important;">$argv</span>&nbsp;2]\n&quot;</span>}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;Last&nbsp;login&quot;</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{interact}
}
interact
</code></pre>
</section>
<p>记得用 <span style="color:#0000ff;">chmod +x iterm-login.sh</span>&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 />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;后续使用<br />
依次把每一台服务器的信息按上面的方法添加profile，完成之后，回到iTerm2主界面，按 Command+O&nbsp;快捷键调出&ldquo;<span style="color:#0000ff;">Profiles</span>&rdquo;对话框，可以在里面输入关键字快速搜索到服务器名，一回车就可以直接登录服务器了，不再需要手工输入用户名、密码，特别方便。</p>
<p><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 />
<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>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
