From e44adbb0b611dfcd3ccc7bf0f1b90141da6a3500 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Tue, 10 Jul 2018 16:03:41 +0100 Subject: [PATCH] Use a better SSH screen launcher. --- .bashrc | 2 +- .ssh/config | 8 ++++++++ .ssh/config.d/screen | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .ssh/config create mode 100644 .ssh/config.d/screen diff --git a/.bashrc b/.bashrc index 75923a4..46ecc6e 100755 --- a/.bashrc +++ b/.bashrc @@ -127,7 +127,7 @@ if ! alias ll >/dev/null 2>&1; then function ll() { ls -l ${@}; } && export -f l [[ -x $(which gsort 2>/dev/null) ]] && function sort() { gsort ${@}; } && export -f sort [[ -x /bin/ps && -x $(which pstree 2>/dev/null) ]] && function ps() { if [[ ${1} =~ 'f' ]]; then pstree; else /bin/ps ${@}; fi } [[ -x $(which tree 2>/dev/null) ]] && alias tree="tree -AQh --du" -function ssh() { $(which ssh) -axt ${@} "screen -xRRAUO 2>/dev/null || bash"; tput reset; } && export -f ssh +alias _ssh="ssh -o RemoteCommand=none" #-------------------------------------------------------------------------------- #-------------------------------------------------------------------------------- diff --git a/.ssh/config b/.ssh/config new file mode 100644 index 0000000..b1efbd0 --- /dev/null +++ b/.ssh/config @@ -0,0 +1,8 @@ +Include config.d/* + +Host * + ServerAliveInterval 120 + ServerAliveCountMax 3 + IdentitiesOnly yes + ForwardAgent yes + diff --git a/.ssh/config.d/screen b/.ssh/config.d/screen new file mode 100644 index 0000000..6db1084 --- /dev/null +++ b/.ssh/config.d/screen @@ -0,0 +1,3 @@ +Match exec "test ${SHLVL} -le 2" + RequestTTY yes + RemoteCommand screen -xRRAUO 2>/dev/null || bash