Topic "How do I port forward via an SSH tunnel with WinSCP?"

Author Message
BartHumphries
[View user's profile]

Joined: 2016-09-22
Posts: 3
I have webpages that I'm editing on the server, and I'm trying to test the links in those pages. But WinSCP brings up a local copy of the file, so the links obviously don't work.

I can Ctrl+P to bring up PuTTY (and my username/password are passed so it just logs right in) then open up PuTTY's settings and add (Connections > SSH > Tunnels) port forwarding, then use my browser (http://localhost/~me) to browse the public_html folder and directly test the links I just added to the pages.

But I don't see a way to automatically add this port forwarding or to otherwise set it so that I can just work.

I did see that I can synchronize my local folder with a server folder and then keep that up to date, so that I can work on my machine and then have changes mirrored over to the server, but I'd just like to make a quick change and don't want to synchronize everything in the folder.

Any suggestions?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Looks like an overkill to me. Why don't you open a browser with the remote address instead?

Maybe this custom command will help you:
https://winscp.net/eng/docs/custom_commands#url

You can actually modify the command, not to copy the URL to clipboard, but to open the URL directly in a browser.
BartHumphries
[View user's profile]

Joined: 2016-09-22
Posts: 3
How do I open a browser with the remote address without affecting my ability to normally use the Internet from my own computer at the same time?

It looks like that command would redirect all url requests from my browser to the other, but that wouldn't establish an SSH tunnel, and without that the other computer would reject a file request from my computer.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Sorry, I probably do not understand what you are trying to achieve.
BartHumphries
[View user's profile]

Joined: 2016-09-22
Posts: 3
When you port forward, you set up a connection to the other computer, such that any "special" URL's in your own browser will be sent to that other computer, instead of being sent out to the rest of the internet, often through an SSH "tunnel".

For instance if I set up port forwarding on port 80, then when I type in "localhost/LOCATION" it will browse LOCATION on the other computer as though I were connected to a server on the internet.

So, if I set up an SSH tunnel to that server that links port 80 on my computer with port 80 on the server, then when I type in "localhost/LOCATION" in my Chrome browser, I get /LOCATION and the public_html folder that I've placed in LOCATION. This then lets me test out links between web pages as though I were sitting at that computer browsing.

This is particularly helpful when (say) port 80 on the server isn't publicly open, and nobody outside the organization can usually connect to the public_html folder that I connected to after setting up the SSH tunnel.

For instance, in PuTTY, I would set something like this... I attached the image. Anyway, I can't add that option to the temporary PuTTY connection that WinSCP opens.

Although it's always possible that your suggestion would fix my problem, but that I don't understand enough about what you were saying to implement it.
putty port forwarding.jpg (62.43 KB)

Description: (none)

putty port forwarding.jpg

Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License