liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.51k stars 265 forks source link

vscode publickey authentication failed #777

Open Ruiboomboom opened 4 years ago

Ruiboomboom commented 4 years ago

I met one problem while using vscode-sftp, it has nothing to do with this plugin, but I hope the solution can help others. I use ssh keys to connect to the remote server, the config is as follow:

{ "name": "x x x", "host": "10.x.x.x", "protocol": "sftp", "port": 22, "username": "zhaorui.teresa", "privateKeyPath": "/Users/zhaorui.teresa/.ssh/id_rsa", "remotePath": "/home/zhaorui.teresa/go/src/xxx", "uploadOnSave": true, "interactiveAuth": true, "ignore":[ ".vscode", ".git", ".DS_Store", "output", "vendor" }

When I try to upload files, "publickey authentication failed" is reported in debug mode. Then you should copy public key to the remote server as follow:

export USER_AT_HOST="your-user-name-on-host@hostname" export PUBKEYPATH="$HOME/.ssh/id_rsa.pub" ssh-copy-id -i "$PUBKEYPATH" "$USER_AT_HOST"`

Try again, you will solve it.