0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【SSH接続】VSCodeでパスワード無しのリモート接続をする方法

0
Posted at

やりたいこと

  • ラズパイにリモート接続する際にパスワード無しで接続したい
  • windows11のvscodeからラズパイのフォルダを操作したい

ラズパイのSSH有効化

  • ラズパイで以下を実行
$ sudo raspi-config
  • 5, Interfacing Optionsを選択
    • P2, SSHを選択
    • Yesを選択

鍵の作成

  • "Windows PowerShell"で以下を実行
    • .sshに移動してから鍵を作成
cd $env:USERPROFILE\.ssh
ssh-keygen -t ed25519 -C "raspi-access"

公開鍵の登録

  • "Windows PowerShell"で以下を実行
    • ラズパイに公開鍵を送信
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh <ユーザ名@IPアドレス> "cat >> ~/.ssh/authorized_keys"

秘密鍵の登録

  • windows11のconfigを編集
    • vscode上でCtrl+Shift+pを押す
    • SSH構成ファイルを開くを選択
    • C:\Users~を選択
    • 以下を入力して保存
Host pi4
  HostName <ラズパイのIPアドレス>
  User <ラズパイのユーザ名>
  IdentityFile C:/Users/<ユーザ名>/.ssh/id_ed25519
  • vscode上でCtrl+Shift+pを押す
    • リモートホストに接続するを選択
    • pi4を選択
    • 接続完了
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?