LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I do the following... (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-do-the-following-876977/)

trist007 04-25-2011 10:30 AM

How can I do the following...
 
My cousin goes to college here in the US. He runs CentOS 5.4 and needs some help configuring things. So I'd like to help remotely. I've been thinking of ways on how to do this. I need some sort of reverse shell. I was hoping to find something with SSH. Obviously since he's behind a NAT router he can't simply have sshd running and them connecting to it. He doesn't have access to the NAT router to place a port forwarding rule. And it's not like he can ssh into my box because I need to configure his computer.

Does SSH have any option for somehow maybe forwarding a shell when he connects to my box on SSH?

The only other thing I can think of is to have netcat listening on my computer and have him run netcat and forward his shell. nc myip port -e /bin/bash. Any other ideas?

Person_1873 04-25-2011 10:38 AM

ssh has the ability to tunnel ports, maybe he could tunnel to your port 443 and then you could connect using localhost:443

EricTRA 04-25-2011 10:39 AM

Hello,

If you completely control your router and machine you can allow him to set up a reverse ssh tunnel from his machine to yours. Configure your router to allow SSH, create a user account for him on your computer, tell him to run the following:
Code:

ssh -R 1234:localhost:22 your_IP
That way he doesn't have to change anything and you can login to his computer by executing:
Code:

ssh hisuser@localhost -p 1234
He will have to keep the session open for you to be able to connect. If he closes his terminal, your session will be disconnected. If you want to overcome that you can use a tool like AutoSSH that will keep the tunnel alive (needs key based authentication to automatically login).
If you want to take it a bit further you can also set up key based authentication between the two computers.

If you don't want to go through the trouble of setting this up, you could also use TeamViewer.

Hope that helps.

Kind regards,

Eric

trist007 04-25-2011 10:43 AM

Fantastic I will try these out, thanks.

EricTRA 04-25-2011 10:55 AM

Hi,

Great! Let us know how it goes. Have fun with Linux.

Kind regards,

Eric


All times are GMT -5. The time now is 07:04 PM.