Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Well, what I want to do seems a bit convoluted but its the only way I can think of to get the result I want.

So here goes.

I want to automate ssh to my Pi, in the following fashion:

  1. My Pi boots up and auto-starts 4 separate instances of screen running bfgminer.

  2. Have a shell script on my laptop to ssh into the Pi and open 4 terminals. 1 per screen instance. So I can monitor them all AND control the terminals. I have looked into tmux, but at this point I'm lost.

So I'm thinking something along these lines:

  1. Pi boots and runs 4 screen instances named USB0, USB1, USB2, USB3 (This is already completed)

  2. On my laptop, open terminal and start my shell script. Something like this:

    gnome-terminal -e <ssh into pi and open 'screen -d -r USB0'>
    gnome-terminal -e <ssh into pi and open 'screen -d -r USB1'>
    gnome-terminal -e <ssh into pi and open 'screen -d -r USB2'>
    gnome-terminal -e <ssh into pi and open 'screen -d -r USB3'>
  3. This will then open 4 terminal windows each automatically connecting to a separate screen instance.

I think this is possible with ssh config file. But I don't know how to do it. I know it should be possible to get ssh to auto login with username and password, and make it call up screen.

Maybe have ssh autologin and run a script on the pi to begin screen?

I have tried using screen's split screen but its not what I want. And tmux scares me.

share|improve this question
up vote 4 down vote accepted

For passwordless connections with ssh you need to :

  1. use ssh-keygen to generate your public key.

  2. use ssh-copy-id to copy the public key to the remote machine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.