ssh-agent shenanigans
This commit is contained in:
parent
8e1ed5b9f4
commit
e7ab5fd04f
|
@ -3,6 +3,7 @@
|
|||
|
||||
# except:
|
||||
!.zshrc
|
||||
!.zprofile
|
||||
!.vimrc
|
||||
!.ideavimrc
|
||||
!.config
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$USER.sock
|
||||
function ssh-agent-start ()
|
||||
{
|
||||
# if that socket does not exist, start the ssh-agent on it
|
||||
if [[ -z $SSH_AGENT_PID ]]
|
||||
then
|
||||
rm $SSH_AUTH_SOCK
|
||||
eval $(ssh-agent -a "$SSH_AUTH_SOCK") > /dev/null
|
||||
# using ssh-add might ask for a password, we don't want that here.
|
||||
# If only using ssh keys without passphrases, you can do this here
|
||||
# ssh-add
|
||||
fi
|
||||
}
|
||||
ssh-agent-start
|
4
.zshrc
4
.zshrc
|
@ -43,8 +43,8 @@ function largefiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(G|T|P|E)\
|
|||
function midfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(M|G|T|P|E)\s" }
|
||||
function smallfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(B|K)\s" }
|
||||
function cachekeys () { exec 2>/dev/null;
|
||||
eval $(ssh-agent)
|
||||
ssh-add ~/.ssh/id_rsa
|
||||
ssh-agent-start # see ~/.zprofile
|
||||
ssh-add
|
||||
}
|
||||
function newpass() {
|
||||
LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c${1:-40}
|
||||
|
|
Loading…
Reference in New Issue