Table of Contents
Basic usage The specific steps
Additional knowledge
Home Development Tools VSCode A brief analysis of how to remotely connect to cloud servers in vscode

A brief analysis of how to remotely connect to cloud servers in vscode

Jun 06, 2022 pm 07:07 PM
vscode

How to remotely connect to the cloud server in vscode? The following article will introduce to you how to connect to your own cloud server remotely in vscode. I hope it will be helpful to you!

A brief analysis of how to remotely connect to cloud servers in vscode

Deployed a small node project on my own cloud server. When encountering small changes, it is a bit troublesome to modify them locally and then upload them to the server.

So I thought that vscode can achieve remote connection. [Recommended learning: "vscode introductory tutorial"]

Plug-in: remote

First ensure that the ssh tool is installed on your terminal.

  • Mac can enter: ssh in the terminal. If the following picture appears, the installation is successful:

A brief analysis of how to remotely connect to cloud servers in vscode

  • This is for Windows:

A brief analysis of how to remotely connect to cloud servers in vscode

My environment is: mac m1pro

Basic usage The specific steps

vscode installation remote plug-in

I have already installed it

A brief analysis of how to remotely connect to cloud servers in vscode

After the installation is successful, an icon will appear in the sidebar, ignoring the ecs I have configured

A brief analysis of how to remotely connect to cloud servers in vscode

Add your own server

First method:

  • Click the plus sign in the picture above

A brief analysis of how to remotely connect to cloud servers in vscode

Enter the IP address of your cloud server and press Enter

  • Use the mouse to select the first file in the picture below

A brief analysis of how to remotely connect to cloud servers in vscode

  • Then get the following picture

A brief analysis of how to remotely connect to cloud servers in vscode

  • At this time, the cloud server we added appears in the box on the left side of vscode

A brief analysis of how to remotely connect to cloud servers in vscode

  • This When we add two more configuration information: User user name, Port port number

A brief analysis of how to remotely connect to cloud servers in vscode

Then you can click the folder icon in the picture below to open the connection .

A brief analysis of how to remotely connect to cloud servers in vscode

  • Summary configuration information

    • Host xxxx: Host refers to the name of the cloud server, which can be customized. Write whatever you want
    • HostName xx.x.xx.x: As the name suggests, fill in the ip address of the cloud service
    • User xxx: The user name used when logging in, such as: root, admin, etc.
    • Port xx: The port number for ssh connection, usually port 22. You can also change it yourself.
    • ForwardAgent yes: generated by vscode itself, the problem is not big, don’t worry about it.

The second method is to click on the small gear and then select the first file. After that, go back to the configuration file and configure it according to the configuration information in the picture above.

Advanced Configuration

What should I do if I don’t want to have to enter a password every time I connect? Answer: Create ssh key

  • First generate the private key and public key files encrypted by rsa.

  • In the terminal, cd to ~/.ssh first, and then enter: ssh-keygen -t rsa -b 4096 -f xxxx (name it yourself)

  • will ask you to enter the password passphrase twice. Enter everything and don’t enter anything. Otherwise, the connection cannot be successful

  • Then two files, the public key and the private key with your own defined name, are generated in the ~/.ssh directory.

  • Then copy the xxx.pub file to the .ssh folder of the server. If the server does not exist, create it yourself. Generally, centos is in the /root/ directory, that is, ~

  • and then execute the command: cat xxxx.pub > authorized_keys (xxx is above your own Customized file name)

  • Then an authorized_keys file will be generated in the current directory

  • Finally, configure the vscode configuration file That’s it

    • Add after the original configuration information:
      • IdentityFile ~/.ssh/xxx
  • Now You can develop as you like.

Ultimate Advanced

  • If you have several servers what to do?
  • Just copy the previous configuration, and then change the IP, nickname and ssh key file name.

Additional knowledge

  • The passphrase mentioned above: What does Enter passphrase (empty for no passphrase) mean?
  • Answer: rsa belongs to asymmetric encryption and has a public key and a private key. Under normal circumstances, this encryption method is theoretically almost foolproof. But it cannot prevent physical attacks. If the enemy intercepts the secret key or public key in some way, it will be GG. The existence of the passphrase is to wrap a layer of symmetric encryption outside the public key and private key. In this way, even if the enemy gets the public key and private key, he will not be able to attack. The safety level has been improved a lot, but it still cannot guarantee 100% safety.

For more knowledge about VSCode, please visit: vscode tutorial!

The above is the detailed content of A brief analysis of how to remotely connect to cloud servers in vscode. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

How to define header files for vscode How to define header files for vscode Apr 15, 2025 pm 09:09 PM

How to define header files using Visual Studio Code? Create a header file and declare symbols in the header file using the .h or .hpp suffix name (such as classes, functions, variables) Compile the program using the #include directive to include the header file in the source file. The header file will be included and the declared symbols are available.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

How to solve the problem of vscode Chinese annotations becoming question marks How to solve the problem of vscode Chinese annotations becoming question marks Apr 15, 2025 pm 11:36 PM

How to solve the problem that Chinese comments in Visual Studio Code become question marks: Check the file encoding and make sure it is "UTF-8 without BOM". Change the font to a font that supports Chinese characters, such as "Song Style" or "Microsoft Yahei". Reinstall the font. Enable Unicode support. Upgrade VSCode, restart the computer, and recreate the source file.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

Common commands for vscode terminal Common commands for vscode terminal Apr 15, 2025 pm 10:06 PM

Common commands for VS Code terminals include: Clear the terminal screen (clear), list the current directory file (ls), change the current working directory (cd), print the current working directory path (pwd), create a new directory (mkdir), delete empty directory (rmdir), create a new file (touch) delete a file or directory (rm), copy a file or directory (cp), move or rename a file or directory (mv) display file content (cat) view file content and scroll (less) view file content only scroll down (more) display the first few lines of the file (head)

vscode Previous Next Shortcut Key vscode Previous Next Shortcut Key Apr 15, 2025 pm 10:51 PM

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

vscode terminal command cannot be used vscode terminal command cannot be used Apr 15, 2025 pm 10:03 PM

Causes and solutions for the VS Code terminal commands not available: The necessary tools are not installed (Windows: WSL; macOS: Xcode command line tools) Path configuration is wrong (add executable files to PATH environment variables) Permission issues (run VS Code as administrator) Firewall or proxy restrictions (check settings, unrestrictions) Terminal settings are incorrect (enable use of external terminals) VS Code installation is corrupt (reinstall or update) Terminal configuration is incompatible (try different terminal types or commands) Specific environment variables are missing (set necessary environment variables)

See all articles