Update recossh with load-ssh-agent function
This commit is contained in:
parent
71038b0a65
commit
2b7c59f8ab
34
zshrc
34
zshrc
|
@ -176,7 +176,6 @@ alias td='tmux detach'
|
|||
# https://github.com/PrivateBin/PrivateBin/wiki/Third-party-clients
|
||||
alias pbin='~/repos/cpaste/cpaste --sourcecode --expire 1week --file '
|
||||
|
||||
|
||||
## Git aliases − Try to prefix with 'gg' {{{
|
||||
### Get status of the repo
|
||||
alias ggstatus='git status'
|
||||
|
@ -314,9 +313,13 @@ alias ping6="ping6 -c 3"
|
|||
## JOSM
|
||||
alias josm="java -jar -Xmx2048M /opt/josm-tested.jar"
|
||||
|
||||
# Function to load ssh-agent with a fix socket path {{{
|
||||
# SSH {{{
|
||||
#########
|
||||
|
||||
# Load ssh-agent with a fix socket path {{{
|
||||
## This function can be used :
|
||||
## 1. in zlogin (for a new shell)
|
||||
## 2. with recossh alias to load a new ssh-agent
|
||||
function load-ssh-agent() {
|
||||
## If a ssh-key is available
|
||||
## AND ssh-agent not launched
|
||||
|
@ -332,6 +335,24 @@ function load-ssh-agent() {
|
|||
source "${SSH_AGENT_ENV}"
|
||||
}
|
||||
# }}}
|
||||
# Clear old entries in known_hosts {{{
|
||||
function clearsshkey() {
|
||||
sed -i "${1}d" ~/.ssh/known_hosts
|
||||
}
|
||||
# }}}
|
||||
|
||||
# recossh will:
|
||||
# (re)load ssh-agent informations
|
||||
# run the previous ssh command
|
||||
alias recossh='load-ssh-agent &&
|
||||
$(fc -lr 4900 | \grep --max-count=1 --extended-regexp "[0-9]{1,4} ssh " | cut --delimiter=" " --fields=4-)'
|
||||
|
||||
# For development and tests
|
||||
alias sshdev='ssh -o UserKnownHostsFile=/dev/null'
|
||||
alias scpdev='scp -o UserKnownHostsFile=/dev/null'
|
||||
|
||||
# }}}
|
||||
|
||||
## Keychain for GPG {{{
|
||||
function gpg() {
|
||||
## If keychain exists, run gpg from default $PATH as usual
|
||||
|
@ -345,10 +366,6 @@ function gpg() {
|
|||
}
|
||||
## }}}
|
||||
|
||||
# ssh
|
||||
alias sshdev='ssh -o UserKnownHostsFile=/dev/null'
|
||||
alias scpdev='scp -o UserKnownHostsFile=/dev/null'
|
||||
alias recossh='source ~/.keychain/cell-info1-sh; !-1'
|
||||
|
||||
# Taskwarrior {{{
|
||||
## Aliases
|
||||
|
@ -551,11 +568,6 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech
|
|||
#####FONCTIONS
|
||||
######################################
|
||||
|
||||
# SSH
|
||||
function clearsshkey() {
|
||||
sed -i "${1}d" ~/.ssh/known_hosts
|
||||
}
|
||||
|
||||
## Verrouiller le shell avec vlock
|
||||
#function TRAPALRM() { vlock }
|
||||
|
||||
|
|
Loading…
Reference in New Issue