forked from adnichols/tmux_setup
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added scripts for working with ssh-agent & added tmux.conf
- Loading branch information
Aaron Nichols
committed
Apr 17, 2011
1 parent
91ea986
commit 5e09d9f
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Setup alias to source ssh variables using command 'fixssh' | ||
alias fixssh='source ~/bin/fixssh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |