LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-16-2010, 08:49 PM   #1
conconga
LQ Newbie
 
Registered: Dec 2009
Posts: 22

Rep: Reputation: 1
take control of a ssh client


Dear Oraculo,

I want to connect two computers using ssh. One is at work, behind a firewall (which I have no access on it), and the other is mine, at home. I want to connect, from home, the one at work at night.

Obviously, the computer at work should be the server, and mine, the client. The point is that the firewall does not allow it, maybe blocking any SYN bit coming from outside of work.

Since I can establish communication when the client is at work and the server is at home, I can make the computer at work try connection periodically, and when I want, take control of the client. Do you know any way of doing that with ssh?

It is worth saying, I cannot ask IT guys any port forwarding.

Regards.
 
Old 10-16-2010, 09:42 PM   #2
vigilandy
Member
 
Registered: Mar 2010
Location: Tokyo
Distribution: Arch, Fedora
Posts: 71

Rep: Reputation: 23
You can do this via the -R switch on the ssh command. You need to forward a port on the home machine to the work server. Do this by logging into the server at work and then ssh into your home computer with the -R switch. Something like:
Code:
[conconga@workserver ~]$ ssh -NR 10022:localhost:22 homeuser@homecomputer &
This will forward port 10022 on your home computer to the work server. The -N flag is to execute the port forward only, and not actually log in to the home PC.

After doing this, from the home computer do:
Code:
[conconga@homepc ~]$ ssh -p 10022 serveruser@localhost
This should log you into the server.

Be aware that the port forward connection can break or timeout, so putting the port forwarding command in a shell script that will reconnect automatically is a good idea.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to setup thin client just for telnet or ssh client use using boot diskless PXE. hocheetiong Linux - Newbie 3 05-21-2008 07:02 PM
console bittorrent client / ssh control Landoln Linux - Software 2 07-16-2006 02:02 AM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration