Table of Contents

Screen and Other Settings For a New Host

<toc><ul><li><link topicref=“2”>GNU/screen</link><ul><li><link topicref=“3”>auto-title for screen</link></li></ul></li><li><link topicref=“4”>SSH keepalive</link></li><li><link topicref=“5”>TCP keepalive</link></li></ul></toc>

GNU/screen

<uri strref=“http://www.wlug.org.nz/Screen”/>

<strong>~/.screenrc</strong>:

startup_message off
bind ' ' windowlist -b
defscrollback 5000
defmonitor on
hardstatus alwayslastline
caption always
caption string '%-Lw%{= BW}%50&gt;%n%f* %t%{-}%+Lw%&lt;'
shelltitle '$ |bash'

<list><ul><li>Ctrl-A 'space' brings up the list of running windows</li><li>Ctrl-A c - create a new window</li><li>Ctrl-A ? - list of more screen commands</li><li>Ctrl-A k - kill the current window (when using screen as a serial console 'screen /dev/ttyUSB0 9600')</li></ul></list> <h2>auto-title for screen</h2> This sets the window title to the command you are currently running on localhost.

<strong>~/.bashrc</strong>:

...
PROMPT_COMMAND='echo -n -e &quot;\033k\033\\&quot;'

The following sets the screen title to the ssh host you have connected to.

<strong>~/.ssh/config</strong>:

Host *
    PermitLocalCommand yes
    LocalCommand tty -s &amp;&amp; echo -ne &quot;\ek%h\e\\&quot;

(On every ssh connection 'LocalCommand' is run, which formats the remote hostname into the needed escape sequence for screen to set the window title).

SSH keepalive

To keep SSH sessions from timing out:

Host *
    ...
    TCPKeepAlive yes

TCP keepalive

To keep all TCP sessions from timing out:

# sysctl -w net.ipv4.tcp_keepalive_time=200
# echo net.ipv4.tcp_keepalive_time=200 &gt;&gt; /etc/sysctl.conf