Topic "How to connect to a machine which is only accesible via another machine using ssh"

Author Message
pc2r0
[View user's profile]

Joined: 2003-05-14
Posts: 1
Hi,

Hope this is helpful I have the following situation:

My computer (globally accessible) <-> computer A (globally accessible) <-> computer B (only accessible to computer A)

So I can ssh/winscp to computer A from my computer but not to computer B directly from my computer. Nonetheless I can ssh from my computer to computer A and then ssh on from computer A to computer B.

What I wanted to do was winscp to computer B from my computer (as it has different nfs mounts to computer A) and here's how you can do it:

create shell script on computer A as follows:

#!/bin/ksh #or your favourite shell
ssh -2 user@comptuerB

save it somewhere sensible on computer A eg in ~/bin/winscploginscript
(and don't forget to chmod a+rx winscploginscript).
(user being your userid).

Then in winscp on my computer create a profile for computer B the same as the one used for logging into computer A (ie put computer A's IP address, password etc), but change the shell (Environment->SCP->Shell->Enter) to ~/bin/winscploginscript.

Now there is a further level of complication. You need to be able to ssh from comptuer A to computer B without having to supply a password. This can be achieved securely using ssh 2 RSA/DSA public key encryption. You'll need to read the ssh (and ssh_keygen) man pages for details, but the gist of it is: type ssh_keygen -t dsa on computer A, then copy ~.ssh/id_dsa.pub from computer A to computer B ~/.ssh.authorized_keys.

And there you have it!

Hope this is helpful,

Paul
_________________
Paul Roberts

pcr20atcam.ac.uk (replace 'at' with @)
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