Assuming Debian is already running on VM and the user name is "user1" and the ip address is 192.168.122.1. SSH port was portforward to 3022.
1. install OpenSSH for windows server
open power shell terminal on Windows and run following commands
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
# This should return the following output:
Name : OpenSSH.Client~~~~0.0.1.0
State : NotPresent
Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Both of these should return the following output:
Path :
Online : True
RestartNeeded : False
2. SSH KeyGen
create ssh key pair in windows local to set up ssh public key authenticate
$ssh-keygen -t rsa -b 4096 $cd .ssh
#make sure ~/.ssh directry is existing in the user home of Debian. $ cat id_rsa.pub | ssh -p 3022 user1@192.168.122.1 'cat >>.ssh/authorized_keys'
3. Install VSCode SSH remote extension
The Remote - SSH extension
4. Install VSCode SSH remote extension
5. Edit/Create the SSH config file
Edit .ssh/config file on your Windows. .ssh folder is located on C:User/username/.ssh
Host 192.168.122.1
HostName 192.168.122.1
User user1
Port 3022
now everything is done.
click the ssh connection button on the left bottom of VSCode and follow the prompt.
0 件のコメント:
コメントを投稿