3

On an embedded device with BusyBox installed I want to set it up so that the gnu screen command is automatically started when any BusyBox session is started.

I have seen that I can add the screen command into the /etc/profile file but are there any other ways of doing this?

2

2 Answers 2

2

If you are using ssh you can just have it run instead of the shell (the default) when you connect.

ssh -t me@host screen -RD

That will create a new session of one does not exist, or otherwise connect to an existing session.

The -t flag to ssh tells to to create a pty even though it is not starting a shell. You need that for interactive use.

1

Add exec screen -R at the end of ~/.profile on the device: every time you log in, your session will reattach the last-created screen session. More precisely, to avoid launching screen in non-interactive sessions where you want to read your .profile to set environment variables, use this:

case $- in *i*) exec screen -R;; esac

You will still be able to avoid attaching to screen in an interactive session by running ssh -t bash -i as this will skip your .profile.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .