Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Helping Friends on the Linux Command-Line

DZone's Guide to

Helping Friends on the Linux Command-Line

Check out a project that allows you to make a terminal that multiple users can interact with, making it easier to demonstrate concepts in the Linux command line.

Free Resource

Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

I noticed that when I was helping a friend on the Linux command-line I was struggling. Spelling the commands over the phone or trying to read their screen over a bad Skype or Hangout screen sharing connection is not really fun. That's why I spent the time to create something that works (for me at least). It allows your friend to connect to your Linux server on which you can open a shell on your friend's computer.

Security

The connection is secured as it listens only on the localhost of your friend's computer and the server. It is a bash shell that is tunneled over SSH to the server using socat. With the tmux terminal program (a younger brother of GNU screen) you can make a terminal that multiple people can view and interact with. This way you can let people show you things while you are on the phone and you can immediately correct it when it is going wrong. Also, the other party can see what you do and learn from it. Or if you are doing something that they don't like then they can terminate the session.

Script-fu

These are the main commands of the script:

ssh -R 6000:localhost:6000 -N user@hostname &
tmux new-session -d -s support
socat exec:"tmux attach -t support",pty,raw,echo=0,stderr,setsid,sigint \
      tcp-listen:6000,bind=localhost,reuseaddr &
tmux attach -t support

These above commands you should run on the client, while the following should run on the server:

socat file:`tty`,raw,echo=0 tcp-connect:localhost:6000

You should adjust the "user@hostname" to the rendezvous server that you are using.

Workflow

When your friend calls you just let him or her connect to your server with socat.sh from my cli-support repository. They most probably already have a web hosting account on your server and if not you spin up a VM for the occasion. Next, you connect to the server and issue the appropriate server command. From that moment you can see the shell of your friend and you can both type. It is recommended that you also set up an audio connection so that you can talk to each other explaining what you are doing (or trying to do).

Conclusion

I created a tool that helped me helping a few friends with simple Linux problems. It works for me and I can see what they are doing wrong and they can see me do it in a different way and learn from it. These problems have been programming, Git, SSH, and DNS related and in most cases I was able to help them out with this tool. There are two things I still want to improve: adjustable screen size on the server (it defaults to 80x25) and a simple delivery of the tool (I now email the installation commands). Other than that I have not found any issues yet. Does it work for you?

Click here to download the cli-support software from Github.

Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation.

Topics:
linux ,bash ,command line ,devops

Published at DZone with permission of Maurits Van Der Schee. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}