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

Advertisement

pc2r0
Joined:
Posts:
1

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

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

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum