Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added scripts for working with ssh-agent & added tmux.conf

  • Loading branch information...
commit 5e09d9fc7b46957fe3e5b7bcc612b530548a896f 1 parent 91ea986
Aaron Nichols authored
View
2  aliases
@@ -0,0 +1,2 @@
+# Setup alias to source ssh variables using command 'fixssh'
+alias fixssh='source ~/bin/fixssh'
View
12 bin/Attach
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Attach to existing ssh session
+
+# Get new ssh vars
+grabssh
+
+# Attach to running tmux session
+if [ ${1} ] ; then
+ tmux -L ${1} attach-session
+else
+ tmux -L prod attach-session
+fi
View
12 bin/grabssh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# This script grabs the ssh-agent variables from your current
+# session when you login and writes them to fixssh as a
+# persistent store - intended to be refreshed each time you login
+SSHVARS="SSH_CLIENT SSH_TTY SSH_AUTH_SOCK SSH_CONNECTION"
+
+for x in ${SSHVARS} ; do
+ (eval echo $x=\$$x) | sed 's/=/="/
+ s/$/"/
+ s/^/export /'
+done 1>$HOME/bin/fixssh
+chmod 600 $HOME/bin/fixssh
View
13 bin/sc
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Wrapper to start tmux sessions for connections to hosts
+
+# This is a security test I like to perform - we want to show what
+# ssh binary is being used to prevent any trickery
+WHICH_SSH=`which ssh`
+
+# Show only the start of the hostname.
+# TODO: Make this work better with IP addresses (only shows first octet)
+HOST=`echo $1|cut -d. -f1`
+
+# Start tmux window
+tmux new-window -n ${HOST} "echo 'Using: $WHICH_SSH' ; ~/bin/sc-ssh ${1}"
View
10 bin/sc-ssh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# This is run instead of ssh directly because it ensures that
+# the correct ssh key info is sourced for this new tmux
+# window
+
+# Setup ssh-agent stuff
+. $HOME/bin/fixssh
+
+# Run ssh command
+ssh -A $1
View
66 tmux.conf
@@ -0,0 +1,66 @@
+# Last modified: 2009-11-12T05:59:41+0800
+
+# Change prefix key to Ctrl+a
+unbind C-b
+set -g prefix C-a
+
+# Last active window
+unbind l
+bind C-a last-window
+bind C-p previous-window
+bind C-n next-window
+bind -n f7 previous-window
+bind -n f8 next-window
+
+# Resize bindings (vim like)
+bind C-k resize-pane -U
+bind C-j resize-pane -D
+bind C-h resize-pane -L
+bind C-l resize-pane -R
+
+# Change window move behavior
+bind . command-prompt "swap-window -t '%%'"
+bind > command-prompt "move-window -t '%%'"
+
+# Copy mode
+unbind [
+bind Escape copy-mode
+# Use Vi mode
+setw -g mode-keys vi
+# Make mouse useful in copy mode
+#setw -g mode-mouse on
+
+# More straight forward key bindings for splitting
+unbind %
+bind | split-window -h
+#bind h split-window -h
+unbind '"'
+bind - split-window -v
+#bind v split-window -v
+
+# History
+set -g history-limit 1000
+
+# Pane
+#unbind o
+bind C-s down-pane
+
+# Terminal emulator window title
+set -g set-titles on
+set -g set-titles-string '#S:#I.#P #W'
+
+# Status Bar
+set-option -g status-bg black
+set-option -g status-fg cyan
+
+# Notifying if other windows has activities
+setw -g monitor-activity off
+set -g visual-activity on
+
+# Highlighting the active window in status bar
+setw -g window-status-current-bg red
+setw -g window-status-current-fg white
+
+# Clock
+setw -g clock-mode-colour green
+setw -g clock-mode-style 24
Please sign in to comment.
Something went wrong with that request. Please try again.