mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
console: ssh-agent for termux
Some checks failed
Update Site / trigger_update (push) Has been cancelled
Some checks failed
Update Site / trigger_update (push) Has been cancelled
This commit is contained in:
parent
8264a067e9
commit
b7728cf9ca
2 changed files with 18 additions and 4 deletions
11
.profile
11
.profile
|
|
@ -51,11 +51,18 @@ fi
|
|||
# SSL Certs:1 ends here
|
||||
|
||||
# [[file:Console.org::*ssh-agent][ssh-agent:1]]
|
||||
SSH_AGENT_DIR="/tmp"
|
||||
|
||||
if [ "$IS_ANDROID" == "true" ]; then
|
||||
SSH_AGENT_DIR="/data/data/com.termux/files/tmp"
|
||||
mkdir -p $SSH_AGENT_DIR
|
||||
fi
|
||||
|
||||
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
|
||||
ssh-agent -t 1h > "/tmp/ssh-agent.env"
|
||||
ssh-agent -t 1h > "$SSH_AGENT_DIR/ssh-agent.env"
|
||||
fi
|
||||
if [[ ! -f "$SSH_AUTH_SOCK" ]]; then
|
||||
source "/tmp/ssh-agent.env" >/dev/null
|
||||
source "$SSH_AGENT_DIR/ssh-agent.env" >/dev/null
|
||||
fi
|
||||
# ssh-agent:1 ends here
|
||||
|
||||
|
|
|
|||
11
Console.org
11
Console.org
|
|
@ -109,11 +109,18 @@ I'm paranoid so I encrypt my SSH keys.
|
|||
Got the idea for below from [[https://wiki.archlinux.org/title/SSH_keys#SSH_agents][ArchWiki]]:
|
||||
|
||||
#+begin_src bash
|
||||
SSH_AGENT_DIR="/tmp"
|
||||
|
||||
if [ "$IS_ANDROID" == "true" ]; then
|
||||
SSH_AGENT_DIR="/data/data/com.termux/files/tmp"
|
||||
mkdir -p $SSH_AGENT_DIR
|
||||
fi
|
||||
|
||||
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
|
||||
ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
|
||||
ssh-agent -t 1h > "$SSH_AGENT_DIR/ssh-agent.env"
|
||||
fi
|
||||
if [[ ! -f "$SSH_AUTH_SOCK" ]]; then
|
||||
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
|
||||
source "$SSH_AGENT_DIR/ssh-agent.env" >/dev/null
|
||||
fi
|
||||
#+end_src
|
||||
** Guix settings
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue