问题
I'm trying to connect to my server using the atom package "Remote-FTP" and using a private key.
I have the SSH keys set up on my server and can connect successfully using putty.
The private key is saved in my project folder and I have an existing .ftpconfig file (without a private key) that connects successfully when I replace the information inside the file.
The Key has been converted to the necessary ssh format and I have no passphrase at the moment. I have also gave the full path of the private key file
Here is my .ftpconfig file -
{
"protocol": "sftp",
"host": "user@server",
"port": 22,
"user": "",
"pass": "",
"promptForPass": false,
"remote": "",
"local": "",
"agent": "",
"privatekey": "putty_private_key_sbappsupconvrted.ppk",
"passphrase": "",
"hosthash": "",
"ignorehost": true,
"connTimeout": 10000,
"keepalive": 10000,
"keyboardInteractive": true,
"watch": [],
"watchTimeout": 500
}
The error code I am receiving is:
REMOTE FTP: Connection...
REMOTE FTP: Connection failed Error: getaddrinfo EAI_FAIL user@server: 22
REMOTE FTP: Connection closed
I have also given the full path of the private key file
C:\Users\user\.atom\server\putty_private_key_sbappsupconvrted.ppk
and I get this error
Could not parse .ftpconfig Unexpected token U in JSON at position 219
Any help would be greatly appreciated
回答1:
Put your private key in following path: C:\Users\USER\AppData\Local\atom\app-1.30.0
Replace USER
. It seems it looks in this folder for the keys.
回答2:
The problem is the backslashes. The .ftpconfig file is in JSON format and slash followed by character has a special meaning. To use your ssh key you just have to escape the slashes. In other words change :
C:\Users\user\.atom\server\putty_private_key_sbappsupconvrted.ppk
To :
C:\\Users\\user\\.atom\\server\\putty_private_key_sbappsupconvrted.ppk
Then it will work with no issues.
来源:https://stackoverflow.com/questions/51152008/issue-connection-to-server-using-remote-ftp-atom-package-and-private-keys