LinuxMCE Forums
June 19, 2013, 09:38:39 pm GMT-1 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com
 
   Home   Help Search Chat Login Register  
Pages: [1] 2
  Print  
Author Topic: Remotely ssh into a machine behind LMCE router  (Read 1316 times)
purps
NEEDS to work for LinuxMCE
***
Posts: 1279


If it ain't broke, tweak it


View Profile
« on: June 13, 2012, 11:56:17 am »

Have spent a lot of time researching this, and am struggling to sort fact from fiction, so thought I would ask my friends at LMCE.

I can ssh into my core using my no-ip IP address no problem, and I can ssh into my desktop from there (which sits on the internal LMCE network).

What I would like to do is remotely ssh into the desktop directly. I undertand this involves me forwarding ports on the router, but I am struggling to put the theory into context.

Could anybody tell me what I have to do to set this up in web admin, and the ssh command I would have to issue? I think I just need a real example to get my head round this.

Cheers,
Matt.
Logged

1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps
my blog :: http://projectsofmatt.wordpress.com/
purps
NEEDS to work for LinuxMCE
***
Posts: 1279


If it ain't broke, tweak it


View Profile
« Reply #1 on: June 13, 2012, 12:21:31 pm »

I should have said, the command I thought most likely to be appropriate was...

Code:
ssh -p1234 <MyExternalIP>

...but I wasn't sure where/what port 1234 was, or the correct way to set this/a port up in web admin. This port must relate to my desktop right?

Cheers,
Matt.

Logged

1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps
my blog :: http://projectsofmatt.wordpress.com/
gadget
Veteran
***
Posts: 136


View Profile
« Reply #2 on: June 13, 2012, 01:06:30 pm »

I don't believe that the LMCE firewall is capable of doing port forwarding, but essentially you would port forward 1234 to port 22 on the internal machine.  I use shorewall but have not configured it to do port forwarding but think it is possible. The config files are pretty straight forward or you can use webmin to configure it.
Logged
DragonK
Guru
****
Posts: 428



View Profile
« Reply #3 on: June 13, 2012, 02:17:36 pm »

In Theory this should work, but havent tested it yet..

ssh your no-ip on port 10015  then the core will forward port 10015 to port 22 on your desktops IP. In the example the Desktop Ip would be 10.0.0.15.

Webadmin -- Advanced -- Network -- Firewall Rules.
Logged
davegravy
Guru
****
Posts: 455


View Profile
« Reply #4 on: June 13, 2012, 04:04:52 pm »

I don't believe that the LMCE firewall is capable of doing port forwarding, but essentially you would port forward 1234 to port 22 on the internal machine.

Why not? I use port forwarding for RDP to an internal machine all the time.
Logged
purps
NEEDS to work for LinuxMCE
***
Posts: 1279


If it ain't broke, tweak it


View Profile
« Reply #5 on: June 13, 2012, 05:44:03 pm »

In Theory this should work, but havent tested it yet..

ssh your no-ip on port 10015  then the core will forward port 10015 to port 22 on your desktops IP. In the example the Desktop Ip would be 10.0.0.15.

Webadmin -- Advanced -- Network -- Firewall Rules.

Thanks for this.

Unfortunately my remote machine says "Connection refused". I have ssh-ed into the core, and then ssh-ed into the desktop in question without any problems. Firewall is set up with a port forward as per your example. Have also tried a few different ports.

Any clues?

Cheers,
Matt.
Logged

1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps
my blog :: http://projectsofmatt.wordpress.com/
DragonK
Guru
****
Posts: 428



View Profile
« Reply #6 on: June 14, 2012, 07:15:28 am »

How does your core access the internet? Via a router?
Logged
purps
NEEDS to work for LinuxMCE
***
Posts: 1279


If it ain't broke, tweak it


View Profile
« Reply #7 on: June 14, 2012, 09:03:35 am »

Nope, it's connected directly to the Internet.

But I can ssh into the core, and then ssh into the desktop, so surely the problem isn't there in any event?

Is there perhaps some sort of special ssh permissions on the desktop I need to set, for when it is being ssh-ed into directly?

No idea.

Cheers,
Matt.
Logged

1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps
my blog :: http://projectsofmatt.wordpress.com/
DragonK
Guru
****
Posts: 428



View Profile
« Reply #8 on: June 14, 2012, 09:09:22 am »

Let me test the theory on my setup, and then I'll get back to you.
Logged
purps
NEEDS to work for LinuxMCE
***
Posts: 1279


If it ain't broke, tweak it


View Profile
« Reply #9 on: June 14, 2012, 10:35:01 am »

Thank you, most kind.

I should mention that I was trying to do this from the point of view of sharing a specific window with a friend, who is in a remote location. But I have no confidence that this is even possible (was hoping to do something clever with an X forward). So remote VNC it is.

One tutorial I've looked at mentions running "ssh -L 5900:localhost:5900 <hostname>" on the remote machine before running the VNC viewer - is that command necessary in addition to what we are trying to do, to create a tunnel? I think that port relates to VNC. Or does it relate to tightVNC specifically? Again, I dunno. I will try it out with this port though when I get home.

Cheers,
Matt.
Logged

1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps
my blog :: http://projectsofmatt.wordpress.com/
WhateverFits
Veteran
***
Posts: 145



View Profile WWW
« Reply #10 on: June 14, 2012, 06:52:24 pm »

OK, what your "ssh -L..." command does is log into your server using SSH and attempts to open a tunnel for VNC (port 5900) from your localhost to your server's VNC. If you want to forward that over to another system use something like:

ssh -L 5900:OtherSystemRunningVNC:5900 YourLinuxMCEServerHere

That should do it. I'm a little rusty on my ssh command line stuff so this is an educated guess.  Grin
Logged

Sigg3.net
Veteran
***
Posts: 64


View Profile
« Reply #11 on: June 16, 2012, 11:51:23 am »

Not sure what you mean by "sharing a specific window", but you can forward graphical programs using the -X flag.

Code:
# ssh -X user@192.168.80.1
# xeyes

or if it's a KDE-app:
Code:
# dbus-launch NAME_OF_APP

When you're in the comfy chair, you don't want to leave the comfy chair. So I can open firefox to configure stuff
Code:
# ssh -X user@192.168.80.1
# dbus-launch firefox URL_OF_WEBADMIN

aso..
Logged
purps
NEEDS to work for LinuxMCE
***
Posts: 1279


If it ain't broke, tweak it


View Profile
« Reply #12 on: June 21, 2012, 07:31:08 pm »

OK, the ssh -L thing did work, but it only logs into the LMCE server - I am looking for a way to remotely ssh directly into another machine on my network.

I also tried ssh -p5900 <LMCEserver> again, but to no avail - connection refused. Admin firewall setting is...

tcp   ipv4   5900 to 5900   22   192.168.80.XXX   port_forward

@Sigg3.net - thanks for the suggestion, but an X forward won't cut it unfortunately. I didn't explain myself very well. I want to be able to share a desktop with somebody remotely (hence I'm now frigging with port 5900, as I intend to use VNC).

Any other suggestions?

Cheers,
Matt.
Logged

1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps
my blog :: http://projectsofmatt.wordpress.com/
purps
NEEDS to work for LinuxMCE
***
Posts: 1279


If it ain't broke, tweak it


View Profile
« Reply #13 on: June 21, 2012, 07:45:13 pm »

I did it (we were nearly right).

Code:
ssh -L 5900:<LMCEserver>:5900 <user>@<othermachine>

Still not quite sure I have understood what I have done... could somebody please educate me? Why is 5900 in there twice? How does this relate to my firewall rule?

Cheers,
Matt.
Logged

1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps
my blog :: http://projectsofmatt.wordpress.com/
WhateverFits
Veteran
***
Posts: 145



View Profile WWW
« Reply #14 on: June 22, 2012, 04:43:24 am »

The first 5900 is for the source and the second is the destination port. Your ssh opens one here and attaches it there. You can map any port to any other port that way. The firewall has no bearing on it since ssh tunnels it over port 23.

I hope that helps.
Logged

Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!