2016-02-29 - remote console

recently i was asked to assist with on linux system remotely. there were just few commands to execute, but it is usually time-consuming to explain something like:

rm -rf `du -s /tmp/* | sort -n | tail -3 | awk '{ print $2 }'`

over a phone, to a person who is not used to working with a shell on a daily basis.

first i've asked for for an ssh access. it was however not possible, since remote computer was behind NAT, on a local network. i had a public IP, i could forward to my SSH on local machine and ask to do a reverse tunnel so that i could connect back to a person's machine. it did not however felt nice, to give an access to my hardware (just a healthy paranoia). finally i proposed to use netcat for this. on my PC:

ncat --ssl -v -l 0.0.0.0 1234

i've tested remote end with help of TOR1):

torify ncat --ssl -v -e /bin/bash my.remote.address 1234

and confirmed i have a console to work with. then i've asked remote end to join, by typing this on his console:

ncat --ssl -v -e /bin/bash my.remote.address 1234

and voila! remote shell to play around. :) it was far from SSH, in terms of usability, but to execute few commands it was just fine.

later on it turned out we'd need to do X forwarding to continue, so the day ended using teamviewer from inside VM2). i'm still thinking about a better solution for non-public IP scenario…

1)
creative use for TOR, to check if all the port forwardings do work fine
2)
zero trust for closed-source apps! :P