Step 1. Copy key file to local server
location: /path/of/key/id_rsa
Step 2. Chmod key file
if the key file is accessible by other group, you will receive an error like below.
Permissions 0777 for ‘/Users/username/.ssh/id_rsa’ are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
To avoid this, just run
> chmod 400 /path/of/key/id_rsa
Step 3. Add a config.sftp file
> vim ~/.ssh/config.sftp
The file looks like below
Host remote_server_host
User username
IdentityFile /path/of/key/id_rsa
Step 4. Install nc on local server
Take Centos as an example, just run
> yum install nc.x86_64
Step 5. Start the SFTP
sftp -F ~/.ssh/config.sftp -o "ProxyCommand /usr/bin/nc -X connect -x proxy_server_host:proxy_server_port %h %p" username@remote_server_host