VSCode Remote Python Debugging without ssh keys
In my October 17, 2019 post, I described remote debugging with VSCode. At this point, Python remote debugging was only possible with VSCode Insider. VSCode Insider is a version that allows you to test the latest or experimental features before applying them to VSCode. However, as time has passed, remote debugging is officially supported in VSCode.
prerequisite
Install VSCode Extensions
Remote Development extension
Install the Remote Development extension in VSCode as in the October 17, 2019 article.
In the October 17, 2019 article, the Remote Development extension was labeled Preview, but no longer has a preview label.
Setup Remote SSH connection
On the October 17, 2019 blog, the only way to access a remote server using ssh is to use an ssh key. However, this method has several drawbacks.
If the remote server information is changed, a new ssh key must be created. I mainly work on the Raspberry Pi and NVidia Jetson series. These single board computers use SD cards as storage space. Therefore, the SD card image is frequently replaced. When the SD card is replaced, the previously created ssh keys are no longer valid. Therefore, id/password authentication is often convenient.
Since VSCode is now able to access ssh in the id/password method, this disadvantage is eliminated.
Now, the config file for ssh connection in VSCode was created as follows.
Old Method (ssh key exchange)
Run VSCode and press Ctrl + Shift + P to search for the extension
command. Then select Remote-SSH: Connect to Host ... Then select C: \
Users \ Users.ssh \ config. And add the following line: Modify the IP,
User, and Private Key routes as appropriate. Refer to https://tipspiggy.blogspot.com/2019/10/remote-python-debugging-with-vscode.html for key generation method.
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config Host Gabia HostName 117.52.89.100 User world IdentityFile ~/.ssh/jumpbox
New Method (id/password)
Run VSCode and press Ctrl + Shift + P to search for the extension
command. Then select Remote-SSH: Connect to Host ... Then select C: \
Users \ Users.ssh \ config. And add the following line: Modify the IP,
User. You no longer need to put an IdentityFile entry.
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config Host Gabia HostName 117.52.89.100 User world
Now let's try new method.
press Ctrl + Shift + P to search for the "Remote-SSH:Connect to host ..."
command. Then select your host that you just configured.
Then you will probably be prompted for the world user's password. If you enter the correct password, you can connect to the remote host.
If you press the Explorer button and then the Open Folder button, you can specify the working directory.
Remote Debugging
Code completion with IntelliSense
Most users who are familiar with IDE environments such as MS Visual Studio love to use code completion features. Code auto-completion not only speeds up development, but also greatly improves productivity by dramatically reducing the amount of typographical errors. Although the Linux development environment has some of these code autocompletion features, unlike the IDE on Windows and Mac, they often have limited functionality or require a paid product. In particular, remote development environments rarely provide this functionality. Using a remote control tool such as VNC is far from the remote development environment described in this article.After installing the remote Python debugging module, VSCode can now write Python code that works on the remote computer using autocomplete. It is a new and powerful feature that you will never experience using the VI editor on a SSH terminal.
Trouble Shooting
"VScode remote connection error: The process tried to write to a nonexistent pipe"
댓글
댓글 쓰기