Alan's BLOG
  • archives
  • posts
  • tags
  • about
  • quote
  • search
Home » Tags

ssh

vscode在wsl環境下連接ssh

👨‍💻Intro 為了實現vscode在wsl環境下使用ssh連接到gce的需求,在爬文後找到一篇解法,因此記錄下來,方便日後查詢 🎯setup 建立ssh.bat檔案,並放在windows下任意位置 C:\Windows\system32\wsl.exe ssh %* vscode設定ssh.bat路徑 打開vscode的settings -> extensions -> Remote - SSH -> Remote.SSH.path將ssh.bat所在路徑貼上 透過管理員身分打開CMD建立連結 C:\Users\User>mklink /D "C:\Users\User\.ssh" "\\wsl$\Ubuntu-20.04\home\alan\.ssh" ## 成功後會顯示以下訊息 已建立 C:\Users\User\.ssh 的符號連結 <<===>> \\wsl$\Ubuntu-20.04\home\alan\.ssh 指令介紹 mklink mklink [option] Source Target mklink:建立連結 /D :連結類型為資料夾 Source:windows連結路徑 Target:wsl家目錄的.ssh資料夾 Reference Can I SSH from WSL in Visual Studio Code? - Stack Overflow Using WSL for Remote-SSH in VS Code – Zit Seng’s Blog Sync VSCode’s SSH with WSL2 – Zit Seng’s Blog Mklink 指令建立 Symbolic Link | ShunNien’s Blog

2023-05-19 · 1 min · 80 words · Alan

gcp遠端連線的幾種方式

Intro🧑‍💻 紀錄有哪些方式可以ssh到gce機器 放key到中繼資料 Compute Enging -> 中繼資料 -> 安全殼層金鑰 使用TCP Tunneling gcloud compute start-iap-tunnel --project project-id --zone vm-zone --local-host-port 127.0.0.1:10001 vm-host 22 使用gcloud ssh gcloud compute ssh --zone vm-zone vm-host --tunnel-through-iap --project project-id 可編寫tunnel的script ## dev gcloud compute start-iap-tunnel dev-border 22 --local-host-port 127.0.0.1:10120 --zone asia-east1-b --project gcp-project & ## test gcloud compute start-iap-tunnel test-border 22 --local-host-port localhost:10121 --zone asia-east1-b --project gcp-project & ## prod gcloud compute start-iap-tunnel prod-border 22 --zone asia-east1-b --local-host-port 127....

2023-02-09 · 1 min · 100 words · Alan
© 2024 艾倫的程式之旅 Powered by Hugo & PaperMod