Linux Blog

Forwarding Ports over an active SSH connection

Filed under: General Linux,Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 12:01 am on Tuesday, October 7, 2008

There is no doubt about it that SSH is a handy administration and remote access tool. Have you ever wanted to add port forwarding or cancel port forwarding from within an active SSH connection? Well, a feature that many do not know about is the ssh escape feature. With this pseudo terminal you can do some nifty things, such as forward ports over an active SSH connection.

To do this, follow these instructions:
(Read on …)

SSH Tunnel

Filed under: Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 11:23 pm on Thursday, March 6, 2008

Today I had the need to access my development web server at my office network. I have a firewall that runs SSH but doesn’t my firewall does not forward the port for the web server. So, in an emergency situation I was able to use an Linux with SSH and Tunnel into my network on port 80. Since I have a server running on port 80 on this computer I could not use this port. I chose port 8080 to use for the local port and forward it to my web server on the firewalled network. I did this by doing the following:

ssh [SSH HOST] -L 8080:192.168.1.X:80

Using SSH Tunneling I was able to then browse to http://localhost:8080 on this computer and successfully view the contents of my web server. So, any time you need to connect to a port on a computer behind a NAT firewall that you have access to SSH on is just use a SSH Tunnel and then use the -L Switch with the port on your local machine first, then the destination address and port. Simple!

Two Screens, Two Linux Boxes – One Keyboard and Mouse

Filed under: General Linux,Quick Linux Tutorials — TheLinuxBlog.com at 8:50 am on Wednesday, September 26, 2007

Ever wished you could use your keyboard and mouse on another computer? In this article I will show you how.
To read it it should take about 60 seconds. In this time I’ll show you how to use one keyboard and mouse on two Linux machines. I’ll cover how to use the same keyboard and mouse on a Linux and Windows machine in another article.

Ready? Lets go!

First Decide which keyboard and mouse you want to use across multiple monitors on different machines and sit at that computer. The program needed to get this to work is called x2x.
As of this writing the stable version is 1.27

Download the stable version from http://x2x.dottedmag.net/

wget http://x2x.dottedmag.net/releases/x2x-1.27.tar.gz

Extract The Source code

tar xvzf x2x-1.27.tar.gz

Compile x2x

./configure && make && make install

If x2x compiled without any errors you should be good to run the program.
On the computer you want to use your primary keyboard and mouse on do the following:
Find out your IP

/sbin/ifconfig ethX

Run xhost to allow clients to connect to your display:

xhost +

Going back to your original computer decide which side of the monitor you want your mouse to jump to the other computer on. It will either be North, South, East or West. If your second linux box is on your left like mine, it will be west.
Now lets get the two computers connected with the same keyboard and mouse:

x2x 192.168.X.X:0.0 -west

Thats all there is to it. You should be able to mouse over the right of your screen and see your mouse cursor on the other computer.