update some content

This commit is contained in:
2021-10-28 14:15:01 +08:00
parent b8600ab259
commit 27b5a11382
163 changed files with 951 additions and 922 deletions

View File

@@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1634607506" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/style.css?v=1635401692" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1634607506" rel="stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1635401692" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@@ -323,41 +323,41 @@ if (!doNotTrack) {
<p><del>建立時,注意一下要指定家目錄路徑</del></p>
<p>更正: 群暉的界面好像不能指定家目錄</p>
<p>預設的路徑如下</p>
<pre tabindex="0"><code>eric:x:1071:100::/var/services/homes/eric:/sbin/nologin
<pre><code>eric:x:1071:100::/var/services/homes/eric:/sbin/nologin
</code></pre><p>不過我覺得怪怪的因為在我手邊的幾台NAS底下 /var/services/homes 都切不過去
確認一下路徑,發現那個 <code>@fake_home_link</code> 根本就不存在啊!</p>
<pre tabindex="0"><code>admin@storage:/volume1$ ls -lart /var/services/homes
<pre><code>admin@storage:/volume1$ ls -lart /var/services/homes
lrwxrwxrwx 1 root root 24 May 23 14:14 /var/services/homes -&gt; /volume1/@fake_home_link
admin@storage:/volume1$
</code></pre><p>我在想是不是之前的人有改過什麼..
anyway ,反正先不管這邊,直接修改 /etc/passwd檔案</p>
<pre tabindex="0"><code>sudo vim /etc/passwd
<pre><code>sudo vim /etc/passwd
</code></pre><p>修正到正確的路徑順便把shell 也改掉,不然不能登入</p>
<pre tabindex="0"><code>eric:x:1071:100::/volume1/homes/eric:/bin/sh
<pre><code>eric:x:1071:100::/volume1/homes/eric:/bin/sh
</code></pre><h3 id="修改-etcsshsshd_config">修改 /etc/ssh/sshd_config</h3>
<p>再來修正預設沒有啟用 Publickey 驗證的 ssh</p>
<pre tabindex="0"><code>sudo vim /etc/ssh/sshd_config
<pre><code>sudo vim /etc/ssh/sshd_config
</code></pre><p>確認底下三行存在</p>
<pre tabindex="0"><code>RSAAuthentication yes
<pre><code>RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
</code></pre><h3 id="將key傳到-nas上">將KEY傳到 NAS上</h3>
<p>先建立相關目錄,順便修正一下目錄權限</p>
<pre tabindex="0"><code>chmod 755 /volume1/homes/eric
<pre><code>chmod 755 /volume1/homes/eric
mkdir -p /volume1/homes/eric/.ssh
chmod 700 /volume1/homes/eric/.ssh
</code></pre><p>再來把Publickey 傳到NAS複製貼上也好ssh-copy-id也可以同時修正權限</p>
<pre tabindex="0"><code>vim /volume1/homes/eric/.ssh/authorized_keys
<pre><code>vim /volume1/homes/eric/.ssh/authorized_keys
chmod 0600 /volume1/eric/.ssh/authorized_keys
</code></pre><h3 id="重啟ssh">重啟SSH</h3>
<p>本來這個步驟應該可以用</p>
<pre tabindex="0"><code>synoservicectl --restart sshd
<pre><code>synoservicectl --restart sshd
</code></pre><p>來解決
但是實際上這個指令只會把你踢出 SSH session &hellip;.( WTF!!! )</p>
<p>所以還是要去NAS的管理界面去關閉再打開SSH (有點蠢..)
<img src="https://i.imgur.com/jcDQmI1.png" alt="Synology WEB UI"></p>
<p>然後就可以測試用Publickey 來登入NAS了</p>
<pre tabindex="0"><code>2018-11-05 14:47:12 [mini@s009 ansiblecontrol]$ ssh admin@storage
<pre><code>2018-11-05 14:47:12 [mini@s009 ansiblecontrol]$ ssh admin@storage
admin@storage:~$
</code></pre><p>確認免密碼登入無誤了!</p>
</article>
@@ -652,7 +652,7 @@ title="pinterest icon"></i>
</div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1634607506"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1635401692"></script>
</body>
</html>