WIN10使用金鑰連線TWSC容器

1. 開啟powershell

2. 輸入ssh-keygen,輸入三次enter,建立金鑰。

ssh-keygen
PS C:\Users\user> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\user/.ssh/id_rsa.
Your public key has been saved in C:\Users\user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:O██████████████████████████████████s happybuffet@hellobuffet
The key's randomart image is:
+---[RSA 3072]----+
|            +B=  |
|████████████████ |
| ████████████████|
|████████████████.|
|█████████████████|
|    ooooo. o +.B+|
| ███████████████=|
|    o   .  o.o = |
|███████████████.=|
+----[SHA256]-----+

3. 開啟TWSC,建立一任意容器,並進入開發型容器詳細資料取得SSH連線資訊

4. 在powershell輸入下方指令,接著輸入主機密碼後,將金鑰上傳登錄至容器內部。

type $env:USERPROFILE\.ssh\id_rsa.pub | ssh {IP-ADDRESS-OR-FQDN} "cat >> .ssh/authorized_keys"

示範指令
type $env:USERPROFILE.ssh\id_rsa.pub | ssh testaccount@203.145.219.158 -p 50725 “cat >> .ssh/authorized_keys”

5. 測試登入,於powershell輸入ssh連線。

示範指令
ssh testaccount@203.145.219.158 -p 50725
Are you sure you want to continue connecting (yes/no/[fingerprint])?輸入yes

6. 使用Mobaxterm連線

參照下方圖片,輸入IP、主機帳號與埠號。
金鑰路徑參照步驟二所建立之rsa key位置,
參考路徑:C:\Users\user\.ssh\id_rsa

7. 刪除所建立的容器

於TWSC 開發型容器管理頁面,刪除所建立容器。
因為金鑰已上傳至HFS空間,後續所新增開發型容器與上傳資料的xdata1節點,
皆可直接使用此次所新增的金鑰進行登入。

 

8. 使用FILEZILLA連線

參照下方圖片與參數
協定:SFTP
主機:xdata1.twcc.ai
埠號:22
登入類型:金鑰檔案
使用者:主機帳號
金鑰檔案位置(參考):C:\Users\user\.ssh\id_rsa

訂閱活動及行銷 EDM