Skip to content

Instantly share code, notes, and snippets.

@mattoc
Created September 27, 2012 23:34
Show Gist options
  • Save mattoc/3797087 to your computer and use it in GitHub Desktop.
Save mattoc/3797087 to your computer and use it in GitHub Desktop.
mattoc's .screenrc
# http://www.deadman.org/sshscreen.php
# Use this when on your remote machine, before you reattach a screen session
alias scratch='$HOME/bin/grabssh; screen -d -R'
# Use this in a screen session on your remote machine when you need agent forwarding
alias fixssh='source $HOME/bin/fixssh'
# See http://mattoc.com/gnu-screen-config/ for a rundown of commands and usage
startup_message off
# Enable 256 colours
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce "on"
# Source an ssh-agent
screen 0
select 0
exec $HOME/bin/screen_ssh_agent.sh
exec true
source $HOME/.ssh/screen_agent
# Don't flash the terminal; no visual 'bell'
vbell off
# Always show window list
hardstatus on
hardstatus alwayslastline "%{b kw}%H %{r}%1` %{w}| %{-b kw}%u %-Lw%{= rW}%50> %n%f %t %{-}%+Lw%<"
#!/bin/sh
SSHVARS="SSH_CLIENT SSH_TTY SSH_AUTH_SOCK SSH_CONNECTION DISPLAY"
for x in ${SSHVARS} ; do
(eval echo $x=\$$x) | sed 's/=/="/
s/$/"/
s/^/export /'
done 1>$HOME/bin/fixssh
#!/bin/sh
ssh-agent | head -2 | cut -d\; -f1 | sed s/^/setenv\ / | sed s/=/\ / > $HOME/.ssh/screen_agent
# http://screen.frogcircus.org/ssh-agent
#!/bin/sh
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -user `whoami` -name agent\* | tail -n 1)
# http://www.tolaris.com/2011/07/12/reconnecting-your-ssh-agent-to-a-detached-gnu-screen-session/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment