ssh -f -N -L

Connect to google talk through ssh by setting your IM client to use the localhost 5432 port

If your firewall or proxy at your location prevents connection to a particular host or port, you can use ssh to tunnel to your home server and do it there instead.

By: dcabanis
2009-06-05 23:17:21

These Might Interest You

  • Check if SSH tunnel is open and open it, if it isn't. NB: In this example, 3333 would be your local port, 5432 the remote port (which is, afaik, usually used by PostgreSQL) and of course you should replace REMOTE_HOST with any valid IP or hostname. The example above let's you work on remote PostgreSQL databases from your local shell, like this: psql -E -h localhost -p 3333

    while true; do nc -z localhost 3333 >|/dev/null || (ssh -NfL 3333:REMOTE_HOST:5432 USER@REMOTE_HOST); sleep 15; done
    rxw · 2015-09-21 02:25:49 1
  • This command adds a urpmi media source called "google-talkplugin" to the urpmi configuration on Mandriva or Mageia. Needs to be run as root. We specify the option "--update" so that when Google provides a newer version of Google Talk plugin in their download system then running a system update (eg: "urpmi --auto-update") will result in our copy of Google Talk plugin getting updated (along with any other Mandriva/Mageia pending updates). To install Google Talk plugin from this source, use: urpmi google-talkplugin # install plugin used for voice and video Google chat via gmail Show Sample Output

    urpmi.addmedia --update google-talkplugin$(uname -m | sed -e "s/i.86/i386/")
    mpb · 2011-04-30 23:01:36 0
  • If you have a client that connects to a server via plain text protocol such as HTTP or FTP, with this command you can monitor the messages that the client sends to the server. Application level text stream will be dumped on the command line as well as saved in a file called proxy.txt. You have to change 8080 to the local port where you want your client to connect to. Change also to the IP address of the destination server and 80 to the port of the destination server. Then simply point your client to localhost 8080 (or whatever you changed it to). The traffic will be redirected to host on port 80 (or whatever you changed them to). Any requests from the client to the server will be dumped on the console as well as in the file "proxy.txt". Unfortunately the responses from the server will not be dumped. Show Sample Output

    mkfifo fifo; while true ; do echo "Waiting for new event"; nc -l 8080 < fifo | tee -a proxy.txt /dev/stderr | nc 80 > fifo ; done
    ynedelchev · 2015-01-14 09:26:54 2
  • It's certainly not nicely formatted SQL, but you can see the SQL in there...

    sudo tcpdump -nnvvXSs 1514 -i lo0 dst port 5432
    ethanmiller · 2009-12-18 17:12:44 1
  • Requires software found at: Remote [A] (with physical serial port connected to device) ./remserial -d -p 23000 -s "115200 raw" /dev/ttyS0 & Local [B] (running the program that needs to connect to serial device) Create a SSH tunnel to the remote server: ssh -N -L 23000:localhost:23000 user@hostwithphysicalserialport Use the locally tunnelled port to connect the local virtual serial port to the remote real physical port: ./remserial -d -r localhost -p 23000 -l /dev/remser1 /dev/ptmx & Example: Running minicom on machine B using serial /dev/remser1 will actually connect you to whatever device is plugged into machine A's serial port /dev/ttyS0.

    remserial -d -p 23000 -s "115200 raw" /dev/ttyS0 &
    phattmatt · 2012-11-19 17:56:02 1
  • It connects to XXX.XXX.XXX.XXX port YYY, using a source port of "srcport" and binds the tunnel on local port "locport". Then you can connect to localhost:locport. With this command it's possible to connect to servers using a specific source port (useful when a firewall check the source port). Because of the connections starting from the same source port, this works well only for the first connection (for example, works well with SSH and bad with HTTP because of multiple requests). * It requires socat Show Sample Output

    socat TCP-LISTEN:locport,fork TCP:XXX.XXX.XXX.XXX:YYY,sourceport=srcport
    cyrusza · 2010-11-22 13:24:33 0

What Others Think

I've used this in the past to get around firewalls, but one thing to remember. If they have the port blocked, they might have a good reason for it.
rattis · 467 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: