linesd
linesd

Reputation: 31

sublime text sftp tunnel wbond

To work remotely I need to SSH into the main server and then again into the departmental server.

I would like to set up a tunnel using sublime text 3 wbond sftp package to view and edit files remotely but I can't seem to find any information for setting up a tunnel. Is this even possible?

The reason I'm interested in this particular package is because I am unable to install any packages locally on the server, hence using something like rsub is not possible.

Any other suggestions besides sublime sftp are welcome.

Upvotes: 0

Views: 691

Answers (1)

Crivella
Crivella

Reputation: 1007

I'm not sure the SFTP plugin would allow to do this directly.
What i would suggest is for you to use ssh -L to create a tunnel.

ssh -L localhost:random_unused_port:target_server:22 username_for_middle_server@middle_server -nNT
Use the password/identity_file for the middle server

The -nNT is to avoid opening an interactive shell in the middle server.
IMPORTANT: You need to keep the ssh -L command running so keep that shell open.
In this way you can connect to the target_server as such:

ssh username_for_target_server@localhost -p random_port_you_allocated

Similarly you can setup the SFTP plugin file as such

{
    ...
    "host":"localhost",
    "user":"username_for_target_server",
    "ssh_key_file": "path_to_target_server_key",
    "port":"random_port_you_allocated",
    ....
}

As a sidenote, always use the same port to tunnel to the same server, otherwise, with the default ssh configuration, you will be warned of a "Man in the middle attack" because the signature saved in the .ssh/known_hosts will not match with the previous one. This can be avoided by disabling this feature but I wouldn't recommend it.

Upvotes: 2

Related Questions