Ssh – how to remotely access a serial modem

remote-accessserialssh

I have a serial modem connected to a computer running ubuntu. I can access it through ssh and modem is working great, I tested it using minicom.

How can I make a remote connection to this modem for development purposes?. By the way, my development computer is running a MacOS X 10.6.4 and my intention is to test my java classes without having to redeploy with each test.

Best Answer

Instead of exposing the modem to the internet. What you need to do is to sent all commands you want to execute thru ssh.

You can do:

ssh -t USER@SERVER 'sudo minicom'

the t option is required since minicom is a screen-based program.


Developing in Java

If you are doing a java development what I would do instead on caling "Runtime.getRuntime().exec("COMMAND")".
Have a class that understand when is running on the developer machine or the actual computer. That way you can call that class with the command that you want to execute. When the projects runs on the developer you can 'encapsulate' the execution with an ssh program like.

Runtime.getRuntime().exec(ssh USER@SERVER 'COMMAND')


Considerations about remotly executing commands without password

  • Do an ssh connection relaying on a public/private key authentication. That way you dont need to enter the password manually on each command sent.

  • Since you are using Ubuntu, if you need to run commands with the sudo modifier have the user you use to connect ssh in /etc/sudoers declared as so: USER ALL= NOPASSWD:ALL