タイトル : Ubuntu22.04(2023/04) その2 VSCのリモート設定 
更新日 : 2023-04-22
カテゴリ : プログラミング
タグ : 
WindowsのVSCからリモート接続
WindowsパソコンとUbuntuパソコンを起動しておいて、Windowsパソコンの画面で作業しています。
RDPは前回行ったので、今日はVisual Studio Codeのリモート設定です。
Windowsでキーの作成
旧Ubuntuにつなぐ時にやってます。Windowsで ssh-keygen します。
C:\Users\XXXX>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\XXXX/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\XXXX/.ssh/id_rsa
Your public key has been saved in C:\Users\XXXX/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX@kiss7
The key's randomart image is:
+---[RSA 3072]----+
|                 |
|                 |
+----[SHA256]-----+
C:\Users\XXXX>今回のUbuntuに公開鍵を登録
今回のUbuntuマシンの上記の公開鍵をSCPして、以下で登録しました。
cat ~/上記の.pub >> .ssh/authorized_keysWindows上でVSCが参照する設定ファイルを更新
以下を追加です
Host kiss9
  HostName 192.168.11.6
  User XXXXX
  IdentityFile C:\Users\XXXXX\.ssh\id_rsa