<?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>SSH &#8211; Gary&#039;s &#8230;Lasamia</title>
	<atom:link href="https://garynil.tw/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>https://garynil.tw</link>
	<description>🍎 📱 🖥 🔨 😄</description>
	<lastBuildDate>Sat, 16 Oct 2021 13:14:50 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.3</generator>

<image>
	<url>https://i0.wp.com/garynil.tw/wp-content/uploads/2017/01/cropped-Gary_v3.0.jpg?fit=32%2C32&#038;ssl=1</url>
	<title>SSH &#8211; Gary&#039;s &#8230;Lasamia</title>
	<link>https://garynil.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">147732124</site>	<item>
		<title>[教學][NAS] Synology NAS SSH 免密碼登入</title>
		<link>https://garynil.tw/2017/10/470/synology-nas-ssh-%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=synology-nas-ssh-%25e5%2585%258d%25e5%25af%2586%25e7%25a2%25bc%25e7%2599%25bb%25e5%2585%25a5</link>
					<comments>https://garynil.tw/2017/10/470/synology-nas-ssh-%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5/#respond</comments>
		
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Wed, 18 Oct 2017 13:04:54 +0000</pubDate>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[synology]]></category>
		<guid isPermaLink="false">https://garynil.tw/?p=470</guid>

					<description><![CDATA[<p>因為會將主機定期備份至 NAS，因此有傳送備份的需求，研究了一下考慮透過 SSH Rsync 的方法。 基本的原理要透過 SSH 執行，但把密碼明碼寫在 script 裡頗不安全，因此便打算透過 SSH authorized_keys 的方法，便可以免密碼登入 詳細教學可以看這篇：免密碼登入ssh 但設定好了主機連至 NAS 的金鑰後，在使用非 root 帳號，並有將帳號加入至 admin group 之後，無論怎樣都無法透過 key 登入成功，變研究了問題與解法： 解決方法 我們的目的是在主機透過 SSH 免密碼連線至 Synology NAS，以下稱主機和 NAS 步驟一： NAS 開啟 SSH 功能及對應的 Port 欲使用的 NAS user 有加入 admin group 並可執行 SSH 服務 教學 步驟二：產生公鑰 在主機上按照步驟產生 public key (id_rsa....</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2017/10/470/synology-nas-ssh-%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5/">[教學][NAS] Synology NAS SSH 免密碼登入</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>因為會將主機定期備份至 NAS，因此有傳送備份的需求，研究了一下考慮透過 SSH Rsync 的方法。<br />
基本的原理要透過 SSH 執行，但把密碼明碼寫在 script 裡頗不安全，因此便打算透過 SSH authorized_keys 的方法，便可以免密碼登入</p>
<p>詳細教學可以看這篇：<a href="https://garynil.tw/2016/12/163/">免密碼登入ssh</a></p>
<p>但設定好了主機連至 NAS 的金鑰後，在使用非 root 帳號，並有將帳號加入至 admin group 之後，無論怎樣都無法透過 key 登入成功，變研究了問題與解法：</p>
<h3>解決方法</h3>
<p>我們的目的是在主機透過 SSH 免密碼連線至 Synology NAS，以下稱主機和 NAS<br />
<span id="more-470"></span></p>
<h4>步驟一：</h4>
<p>NAS 開啟 SSH 功能及對應的 Port<br />
欲使用的 NAS user 有加入 admin group 並可執行 SSH 服務 <a href="https://www.synology.com/zh-tw/knowledgebase/DSM/tutorial/General/How_to_add_extra_security_to_your_Synology_NAS">教學</a></p>
<h4>步驟二：產生公鑰</h4>
<ol>
<li>在主機上按照步驟產生 public key (id_rsa.pub) 並透過 SCP 等方式傳送至 NAS</li>
<li>將 public key 加入至 <code>~/.ssh/authorized_keys</code> (你自己 home directory 下的 .ssh 資料夾內)<br />
可以參考<a href="https://garynil.tw/2016/12/163/">這篇</a></li>
</ol>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">cd /var/services/homes
chmod 755 ./你的username資料夾名稱</pre><p></p>
<p>並將 你自己 Home Folder 底下的 .ssh 資料夾權限也一併更改</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">scp -P NAS連接阜 ~/.ssh/id_rsa.pub "NAS帳號"@"NAS IP或域名":~/id_rsa.pub</pre><p></p>
<h4>步驟三：更改資料夾權限</h4>
<p>透過 SSH 及密碼連線至 NAS 後，執行以下動作<br />
將你的 username 資料夾權限改成 755，使其他服務，例如 sshd 可讀並執行<br />
不然預設 sshd 是無法存取你的 authorized_keys</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">cd /var/services/homes
chmod 755 ./你的username資料夾名稱</pre><p></p>
<p>並將 你自己 Home Folder 底下的 .ssh 資料夾權限也一併更改</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">mkdir ./.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys</pre><p></p>
<p>並按照 SSH 那篇<a href="https://garynil.tw/2016/12/163/">教學</a>加入上傳的 key</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">cat id_rsa.pub >> ~/ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys</pre><p></p>
<h4>步驟四：更改 sshd 設定</h4>
<p>更改 <code>/etc/ssh/sshd_config</code> 裡的設定， Synology NAS 預設並無開啟 authorized_keys 登入功能</p>
<p>先以 vim 指令搭配管理員權限來編輯 sshd_config 檔案：</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">sudo vim /etc/ssh/sshd_config</pre><p></p>
<p>以 vim 開啟後，找到以下三行並取消註解 (刪除行前 # 字號，按 i 更動，esc 完成，詳細請查詢 vim 指令)</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys</pre><p></p>
<p>以 :wq 結束檔案編輯</p>
<h4>步驟五：重啟 SSH 服務</h4>
<p>Synology ssh 服務重起指令比較特別：</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">synoservicectl --restart sshd</pre><p></p>
<p>如果遇到更改後 connection refuse，去控制台終端機，將 SSH 開關關閉儲存後再開啟儲存即可<br />
如此，你便能成功的免密碼登入 NAS 了！</p>
<p><img fetchpriority="high" decoding="async" src="https://igk1hg.bl3302.livefilestore.com/y4m552P1wak7lMoxPYCpwTubAuYXRRBgBf_YY6DuOPakfF5MqF0WS55Ackcnv7o2tCQixieEAYrU8Eb_50Lj-t4Y3VB8K7YSptlWZL1wvCsfbFgKY0UuSqb7Upg437K_VewmioTd_rCSRAKxxEkiPcUUbySPymELidwEyoVpJrnVO1EemkJq7unS_5cXohmlxtrxVIV5Yi-gOGo6elKjy2o-w?width=682&#038;height=587&#038;cropmode=none" width="682" height="587" /></p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2017/10/470/synology-nas-ssh-%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5/">[教學][NAS] Synology NAS SSH 免密碼登入</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://garynil.tw/2017/10/470/synology-nas-ssh-%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">470</post-id>	</item>
		<item>
		<title>透過 USB 傳輸線 SSH 進入 iPhone 等 iDevice</title>
		<link>https://garynil.tw/2016/12/255/%e9%80%8f%e9%81%8e-usb-%e5%82%b3%e8%bc%b8%e7%b7%9a-ssh-%e9%80%b2%e5%85%a5-iphone-%e7%ad%89-idevice/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e9%2580%258f%25e9%2581%258e-usb-%25e5%2582%25b3%25e8%25bc%25b8%25e7%25b7%259a-ssh-%25e9%2580%25b2%25e5%2585%25a5-iphone-%25e7%25ad%2589-idevice</link>
					<comments>https://garynil.tw/2016/12/255/%e9%80%8f%e9%81%8e-usb-%e5%82%b3%e8%bc%b8%e7%b7%9a-ssh-%e9%80%b2%e5%85%a5-iphone-%e7%ad%89-idevice/#respond</comments>
		
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Sat, 31 Dec 2016 14:34:37 +0000</pubDate>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Dev Tool]]></category>
		<category><![CDATA[iDevice]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[USB]]></category>
		<guid isPermaLink="false">https://garynil.tw/?p=255</guid>

					<description><![CDATA[<p>有在開發或使用 SSH (Secure Shell) 登入 iPhone 等 iDevice 的人一定會遇到這些情況 出門在外，沒有 wifi 卻需要 SSH 登入 iPhone 有時將 iPhone 連上個不常使用的 Wifi 熱點，想要 SSH 登入時還要特地去設置然後找 IP 經過頗多步驟 這些等等等的情況，其實都有個簡單的方式可以解決， 就是透過你一定擁有的 iPhone 傳輸線，簡單的透過傳輸線將 iPhone 接到你的電腦的 USB port，就可以很方便的 SSH 進入 需求 iDevice 設備 具有資料傳輸功能的傳輸線 (接上電腦，iTunes可以正常偵測到你的 iDevice 即可) 具有 USB port 的電腦 (Type-C也可啦..XD) iDevice 上需要安裝 OpenSSH 而要透過什麼來完成這項目的呢？其實透過一套網路上的 Library：usbmux...</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2016/12/255/%e9%80%8f%e9%81%8e-usb-%e5%82%b3%e8%bc%b8%e7%b7%9a-ssh-%e9%80%b2%e5%85%a5-iphone-%e7%ad%89-idevice/">透過 USB 傳輸線 SSH 進入 iPhone 等 iDevice</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>有在開發或使用 SSH (Secure Shell) 登入 iPhone 等 iDevice 的人一定會遇到這些情況</p>
<ul>
<li>出門在外，沒有 wifi 卻需要 SSH 登入 iPhone</li>
<li>有時將 iPhone 連上個不常使用的 Wifi 熱點，想要 SSH 登入時還要特地去設置然後找 IP 經過頗多步驟</li>
</ul>
<p>這些等等等的情況，其實都有個簡單的方式可以解決，<br />
就是透過你一定擁有的 iPhone 傳輸線，簡單的透過傳輸線將 iPhone 接到你的電腦的 USB port，就可以很方便的 SSH 進入<br />
<span id="more-255"></span></p>
<h3>需求</h3>
<ul>
<li>iDevice 設備</li>
<li>具有資料傳輸功能的傳輸線 (接上電腦，iTunes可以正常偵測到你的 iDevice 即可)</li>
<li>具有 USB port 的電腦 (Type-C也可啦..XD)</li>
<li>iDevice 上需要安裝 OpenSSH</li>
</ul>
<p>而要透過什麼來完成這項目的呢？其實透過一套網路上的 Library：<a href="https://github.com/libimobiledevice/usbmuxd" target="_blank" rel="noopener">usbmuxd</a></p>
<p>安裝方式很簡單，下載來使用即可：<a href="http://pkgs.fedoraproject.org/repo/pkgs/usbmuxd/" target="_blank" rel="noopener">官方連結</a><br />
但有版本差異，最新 1.1.0 必須透過複雜的安裝方式，所以我是下載 <a href="http://pkgs.fedoraproject.org/repo/pkgs/usbmuxd/usbmuxd-1.0.6.tar.bz2/c8909cfd9253d8d1a5e26f2ff7e5908b/usbmuxd-1.0.6.tar.bz2" target="_blank" rel="noopener">1.0.6</a> 版本可以直接執行</p>
<p>透過 curl 指令下載<br />
<code>$ curl -OL http://pkgs.fedoraproject.org/repo/pkgs/usbmuxd/usbmuxd-1.0.6.tar.bz2/c8909cfd9253d8d1a5e26f2ff7e5908b/usbmuxd-1.0.6.tar.bz2</code></p>
<p>放置指定路徑然後解壓縮<br />
<code>$ tar jxvf usbmuxd-1.0.6.tar.bz2</code></p>
<p>移動至內部一個 pytohn-client 的資料夾內<br />
<code>$ cd ./usbmuxd-1.0.6/python-client</code></p>
<p>這裡要注意的是，要先將 tcprelay.py 這個檔案改權限並更動為可執行，一般使用者才可以正常執行<br />
<code>$ chmod +x tcprelay.py</code></p>
<p>然後就可以透過這串指令來開啟 USB port forward 了！<br />
<code>$ ./tcprelay.py -t 22:2222</code><br />
<img data-recalc-dims="1" decoding="async" data-attachment-id="14293" data-permalink="https://garynil.tw/2016/12/255/%e9%80%8f%e9%81%8e-usb-%e5%82%b3%e8%bc%b8%e7%b7%9a-ssh-%e9%80%b2%e5%85%a5-iphone-%e7%ad%89-idevice/31854892682_79493a38df_z/" data-orig-file="https://i0.wp.com/garynil.tw/wp-content/uploads/2016/12/31854892682_79493a38df_z.jpg?fit=640%2C506&amp;ssl=1" data-orig-size="640,506" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="31854892682_79493a38df_z" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/garynil.tw/wp-content/uploads/2016/12/31854892682_79493a38df_z.jpg?fit=640%2C506&amp;ssl=1" src="https://i0.wp.com/garynil.tw/wp-content/uploads/2016/12/31854892682_79493a38df_z.jpg?resize=640%2C506&#038;ssl=1" alt="" width="640" height="506" class="aligncenter size-full wp-image-14293" /><br />
開啟之後，這時你就可以透過 SSH 來登入了！<br />
<code>ssh root@localhost -p 2222</code></p>
<p>當然，每次都要 cd 到指定位置然後執行一串指令非常麻煩<br />
所以可以簡化成一步驟</p>
<p>1.可以將以下這個路徑設置至你所使用預設 shell 內 (Bash 或 ZSH 等)，我是使用ZSH，因此是改動 ~/.zshrc</p>
<p><code>export USBPort=/你放置資料夾的路徑/usbmuxd/python-client/</code></p>
<p>之後你便可以在終端機內 使用 <code>$USBPort/tcprelay.py -t 22:2222</code> 這快速的捷徑路徑，不用在自己慢慢找</p>
<p>2.更偷懶可以透過 <a href="https://textexpander.com" target="_blank" rel="noopener">Text Expander</a> 然後快速輸入上面那串&#8230;</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2016/12/255/%e9%80%8f%e9%81%8e-usb-%e5%82%b3%e8%bc%b8%e7%b7%9a-ssh-%e9%80%b2%e5%85%a5-iphone-%e7%ad%89-idevice/">透過 USB 傳輸線 SSH 進入 iPhone 等 iDevice</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://garynil.tw/2016/12/255/%e9%80%8f%e9%81%8e-usb-%e5%82%b3%e8%bc%b8%e7%b7%9a-ssh-%e9%80%b2%e5%85%a5-iphone-%e7%ad%89-idevice/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">255</post-id>	</item>
		<item>
		<title>免密碼登入ssh</title>
		<link>https://garynil.tw/2016/12/163/%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5ssh/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e5%2585%258d%25e5%25af%2586%25e7%25a2%25bc%25e7%2599%25bb%25e5%2585%25a5ssh</link>
					<comments>https://garynil.tw/2016/12/163/%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5ssh/#comments</comments>
		
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Mon, 26 Dec 2016 06:19:11 +0000</pubDate>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Dev Tool]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Terminal]]></category>
		<guid isPermaLink="false">https://garynil.tw/?p=163</guid>

					<description><![CDATA[<p>相信大家有類似的經驗，在使用 SSH 登入，往往都要輸入密碼，但是常用主機如果設置的是亂碼或者複雜性密碼，每次都要輸入一次頗為不便 又或者有些情況下想要免密碼登入 (便利性、rsync、script操作) ，這時候透過金鑰達成免密碼登入會便利很多！ 那以下步驟以機器A、機器B來稱呼兩台主機： 機器 A (Client) 為你正在操作的電腦，透過終端機操作 SSH 指令 機器 B (Server) 為你使用 SSH 登入的遠端的主機 步驟一：產生公鑰 首先，你需要在機器 A (Client) 產生給機器B (Server) 主機使用的金鑰組 $ ssh-keygen -t rsa 圖 金鑰組則會有兩個檔案：公鑰 (public key) 、私鑰 (private key) 一般來說，公鑰 (public key) 的路徑及檔名會像是這樣： ~/.ssh/id_rsa.pub 而私鑰 (pri...</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2016/12/163/%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5ssh/">免密碼登入ssh</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>相信大家有類似的經驗，在使用 SSH 登入，往往都要輸入密碼，但是常用主機如果設置的是亂碼或者複雜性密碼，每次都要輸入一次頗為不便<br />
又或者有些情況下想要免密碼登入 (便利性、rsync、script操作) ，這時候透過金鑰達成免密碼登入會便利很多！</p>
<p>那以下步驟以機器A、機器B來稱呼兩台主機：<br />
機器 A (Client) 為你正在操作的電腦，透過終端機操作 SSH 指令<br />
機器 B (Server) 為你使用 SSH 登入的遠端的主機</p>
<p><span id="more-163"></span></p>
<h3>步驟一：產生公鑰</h3>
<p>首先，你需要在機器 A (Client) 產生給機器B (Server) 主機使用的金鑰組</p>
<p><code>$ ssh-keygen -t rsa</code></p>
<p>圖<br />
金鑰組則會有兩個檔案：公鑰 (public key) 、私鑰 (private key)<br />
一般來說，公鑰 (public key) 的路徑及檔名會像是這樣：<br />
<code>~/.ssh/id_rsa.pub</code></p>
<p>而私鑰 (private key) 的則是會像是這樣：<br />
<code>~/.ssh/id_rsa</code></p>
<p>這些檔案因為安全性當然不要外流。</p>
<h3>步驟二：複製公鑰至主機，加入主機的信任清單中</h3>
<p>將剛剛產生的 public key (id_rsa.pub) 透過 SCP 指令拷貝到機器 B (Server) 中，加入你所擁有帳號之下的 .ssh/authorized_keys 中</p>
<p><code>$ scp -P <strong>'server-Port'</strong> ~/.ssh/id_rsa.pub <strong>'server-User@server-IP'</strong>:~/id_rsa.pub</code><br />
範例：<br />
<code>scp -P 2222 ~/.ssh/id_rsa.pub root@localhost:~/id_rsa.pub</code></p>
<p>之後在 SSH 進入你的主機，在主機內輸入</p>
<p><code>cat id_rsa.pub >> .ssh/authorized_keys</code></p>
<p>如果出現沒有 authorized_keys 的話：<br />
<code>touch ~/.ssh/authorized_keys</code></p>
<p><code>chmod 600 .ssh/authorized_keys</code><br />
移動至目標位置然後改到對應的權限即可</p>
<p>註1：這邊要確認你的主機端有安裝 SSH 以及 SCP 指令，有遇過 iOS 10 Jailbreak 裝置沒有預設安裝的狀況XD<br />
註2：如果機器 B (Server) 你所擁有的帳號沒有 .ssh/authorized_keys 的路徑，在你複製時會直接顯示錯誤，解決方法是先透過 SSH 登入至 機器 B，並執行開創.ssh資料夾的動作 <code>mkdir .ssh</code> 便會產生相關路徑。<br />
註3：偷懶法：<code>ssh-copy-id -i root@ip_address</code></p>
<h3>延伸應用：</h3>
<ol>
<li>步驟一產生的金鑰如果可供任意寫入頗為危險，因此有些人會改掉相關檔案的權限</li>
</ol>
<p><code>$ ssh 'server-User@server-IP'</code><br />
<code>$ chmod 400 ~/.ssh/authorized_keys #關閉存取</code></p>
<p>如果要打開存取用下列指令就可以了：<br />
<code>$ chmod 600 ~/.ssh/authorized_keys #可供寫入</code></p>
<p>參考來源：<a href="http://gwokae.mewggle.com/wordpress/2010/08/超易-兩行指令搞定-linux-ssh登入免密碼/#step1-key-pair-genSH登入免密碼" target="_blank">LinXblog [超易] 兩行指令搞定 Linux SSH登入免密碼</a></p>
<ol>
<li>關閉主機密碼登入<br />
因為安全性，有些人會將主機的密碼登入功能關閉，主機僅會比對金鑰以供登入<br />
而要達成這項功能，只允許使用金鑰來做登入，可以修改以下這個檔案的兩個參數：</li>
</ol>
<p><code>$ vim /etc/ssh/sshd_config</code><br />
將<br />
<code>PubkeyAuthentication yes</code><br />
<code>PasswordAuthentication no</code><br />
設為對應的值就可以完成了</p>
<p>參考來源：<a href="https://blog.longwin.com.tw/2005/12/ssh_keygen_no_passwd/" target="_blank">Tsung&#8217;s Blog ssh keygen 免輸入密碼</a></p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2016/12/163/%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5ssh/">免密碼登入ssh</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://garynil.tw/2016/12/163/%e5%85%8d%e5%af%86%e7%a2%bc%e7%99%bb%e5%85%a5ssh/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">163</post-id>	</item>
	</channel>
</rss>
