1 |
On Monday 20 Aug 2012 12:35:06 David Relson wrote: |
2 |
> On Mon, 20 Aug 2012 06:50:29 +0100 |
3 |
> |
4 |
> Mick wrote: |
5 |
> > On Monday 20 Aug 2012 04:48:40 Canek Peláez Valdés wrote: |
6 |
> > > On Sun, Aug 19, 2012 at 10:31 PM, David Relson |
7 |
> > > <relson@×××××××××××××.com> |
8 |
> > |
9 |
> > wrote: |
10 |
> > > > G'day, |
11 |
> > > > |
12 |
> > > > I've volunteered to do some data entry for my local bike club. |
13 |
> > > > This involves a java application (jar file) and a tunnel to a |
14 |
> > > > mysql server. I have detailed PuTTY configuration instructions |
15 |
> > > > but haven't yet succeeded in converting them to ssh options. |
16 |
> > > > |
17 |
> > > > The configuration options include: |
18 |
> > > > Seconds between keepalives -- 120 |
19 |
> > > > Don't start a shell or command |
20 |
> > > > |
21 |
> > > > Forwarded port: |
22 |
> > > > source port number - PORT |
23 |
> > > > Destionation: MACHINE.DOMAIN.COM |
24 |
> > > > |
25 |
> > > > Host - IP_Address |
26 |
> > > > Login - userid |
27 |
> > > > Password - pw |
28 |
> > > > |
29 |
> > > > Using "ssh -N userid@IP_Address" gives me a password prompt and no |
30 |
> > > > command prompt - both good. |
31 |
> > > > |
32 |
> > > > How do I specify the forwarded port? |
33 |
> > > |
34 |
> > > If I understand correctly, with -L: |
35 |
> > > |
36 |
> > > ssh -L XX:machine2:YY user@machine1 |
37 |
> > > |
38 |
> > > This command will connect you to the "machine1" host with user |
39 |
> > > "user", and any connection to the port XX to the machine you are |
40 |
> > > running the ssh command from, will redirect the connection to the |
41 |
> > > "machine2" host in the YY port. |
42 |
> > |
43 |
> > If you want to forward a local port XX to a remote port YY then |
44 |
> > Canek's suggestion will do what you want, assuming that the correct |
45 |
> > remote application is listening on port YY. |
46 |
> > |
47 |
> > When you have more than one application this can soon become |
48 |
> > tedious. So, if you want to set up the remote machine as a SOCKS |
49 |
> > proxy so that any socks-ified applications on the local machine can |
50 |
> > |
51 |
> > connect to the remote SOCKS, then you can use: |
52 |
> > ssh -N -D XXXX user@machine1 |
53 |
> > |
54 |
> > For applications that do not have built in proxy capability you can |
55 |
> > use e.g. proxychains. |
56 |
> > |
57 |
> > HTH. |
58 |
> |
59 |
> H'lo Mick and Carnek, |
60 |
> |
61 |
> The mention of XX and YY wasn't transparent, but a bit of |
62 |
> experimentation gave a good connection. Using the terms in my original |
63 |
> post, I now have the following working command: |
64 |
> |
65 |
> ssh -2 -N -L PORT:MACHINE.DOMAIN.COM:22 userid@IP_Address |
66 |
> |
67 |
> Just need to add an appropriate TCPKeepAlive and all will be good. |
68 |
> |
69 |
> Thank you both for your tips.. |
70 |
|
71 |
You're welcome. BTW, port 22 in your example above does not *have* to be port |
72 |
22. As a matter of fact if it isn't, it would avoid zillions of connection |
73 |
attempts by stupid botnets that could drive up your bandwidth consumption. It |
74 |
could also be the same port as the one you use at your local host. Whichever |
75 |
port you choose, you'll have to allow it through the firewall at the remote |
76 |
machine and of course whichever application is running at the remote host that |
77 |
you want to connect to, should be listening on said port. |
78 |
-- |
79 |
Regards, |
80 |
Mick |