Using University of Manchester HYDRA server - lmmx/devnotes GitHub Wiki

Automate secure passwordless login/file sync with SSH keys

Logging into the University of Manchester HYDRA server:

Assuming already generated SSH keys for use with GitHub (see notes on regenerating them if needed), no need to run ssh-keygen and ssh-add to store keys in a keychain (for secure handling with ssh-agent).

  • After sshing into the server, ls ~/.ssh/authorized_keys will show the presence of keys on the server, i.e. it supports SSH key automated logins rather than manual password each time
  • run ssh-copy-id [email protected] to add your SSH key to the server, provide the server your password to confirm
  • the above ssh command will no longer prompt for a password, nor will scp/rsync.

Alias ssh

Add to (local) .bashrc:

alias hydra="ssh [email protected]"

Logging into the HYDRA server is now just hydra

Automatically start tmux

[dotfiles/server/.bashrc]

Add to (server) ~/.bashrc:

# Load tmux

if command -v tmux>/dev/null; then
        if [ ! -z "$PS1" ]; then
                [ -z $TMUX ] && tmux
        fi
fi

[dotfiles/server/.tmux.conf]

Add to (server) ~/.tmux.conf:

unbind C-b
set -g prefix C-a
bind C-a send-prefix

set -g mode-mouse on
set -g mouse-resize-pane on

(Assuming default Ctrl+B keybinding has not been changed) your local and server tmux instances obviously cannot share the same keybindings, meaning Ctrl + B cannot be used for using tmux on the server, Ctrl + arrow keys cannot be used for resizing its panes either. Set Ctrl + A and turn on mouse mode (to click and drag pane boundaries instead). Also requires holding Shift when highlighting text to copy (Ctrl + C).

⚠️ **GitHub.com Fallback** ⚠️