[Solved] Vscode Connect to the remote server error: permission denied (public key)

Background

The purpose is to edit the intranet server code locally

However, the springboard machine of the company’s server needs to log in with a key. In addition, there is a dynamic password + personal password. It has not been configured directly with vscode

The termius implementation is borrowed here

How to Solve:

    1. ensure that termius has logged in to the intranet server through the key dynamic password. Use the port forwarding function provided by termius to connect the local XX port to the YY port of the intranet server. Note that the intranet server port here depends on the personal opening. Configure the local ~ /. SSH/config file. For example, the content is as follows
Host local
    HostName 127.0.0.1
    Port xx port
    User Your own username for logging into the server
      1. put a copy of the public key given to you by the company in ~ /.SSH/ and pay attention to these key permissions. Generally, the key is only open to individuals, otherwise an error is reported. For example, permission denied (public key), Chmod 600 ~ /.SSH/* can be executed to change the key files of local and remote servers to only allow individuals to read and write, and the file can be modified locally directly through vscode connection.

 

Read More: