2020年4月23日 星期四

SSH into Azure Linux Virtual Machine using SSH public-private key pair with Putty (使用Putty採用SSH private key連線到Azure Linux Virtual Machine)

SSH into Azure Linux Virtual Machine using SSH public-private key pair with Putty
使用Putty採用SSH private key連線到Azure Linux Virtual Machine

1.下載private key
如果使用Azure Cloud Shell(Bash)建立的Linux VM

az vm create --resource-group myRG1 --name myVM2 --image UbuntuLTS --admin-username azureuser --generate-ssh-keys

SSH public-private key會儲存在~/.ssh/目錄下
~/.ssh/id_rsa是private key
~/.ssh/id_rsa.pub是public key



2.下載id_rsa (private key)

輸入/id_rsa,然後按下Download


3.use the PuTTYgen to convert the key from the OpenSSH format to the PuTTY format.
將private key轉換為Putty可讀取的格式

按下Load,選擇C:\Temp\Azure\id_rsa 檔案
然後按下Save private key,將檔案儲存為C:\Temp\Azure\id_rsa.ppk


4.Configure SSH Keys Authentication for PuTTY
使用Pageant設定SSH KEY授權
啟動Pagent後,在系統右下角常駐程式區,在Pageant圖示按下右鍵選擇Add Key

選擇上一個步驟所產生的 id_rsa.ppk


5.Connect to Azure Linux VM with Putty

使用Putty連線到Azure Linux VM
Host Name輸入 使用者帳號@VM的外部IP,例如 azureuser@13.67.65.46





Pageant does not load SSH-2 key generated with GitBash
https://stackoverflow.com/questions/27129904/pageant-does-not-load-ssh-2-key-generated-with-gitbash
How To Configure SSH Keys Authentication With PuTTY And Linux Server
https://putty.org.ru/articles/putty-ssh-key-auth.html

沒有留言:

Copy or Backup Command - robocopy

  robocopy D:\Backup E:\Backup /MIR /MT:100 /LOG+:C:\Logs\robocopy.log /MIR  鏡像目錄樹(包含 空的子目錄 ), 確保目標目錄與來源目錄完全相符,並比對刪除目標中不存在於來源中的任何檔案或目錄, /MT:...