16 lines
416 B
Bash
16 lines
416 B
Bash
#!/bin/bash
|
|
|
|
# Start the ssh-agent if it's not already running
|
|
if [ ! -S /tmp/ssh-agent.sock ]; then
|
|
eval $(ssh-agent -a /tmp/ssh-agent.sock)
|
|
fi
|
|
|
|
# Export environment variables globally
|
|
export SSH_AUTH_SOCK=/tmp/ssh-agent.sock
|
|
echo "export SSH_AUTH_SOCK=/tmp/ssh-agent.sock" >> /etc/profile.d/ssh-agent.sh
|
|
|
|
# Optionally preload keys
|
|
# ssh-add /path/to/id_rsa
|
|
|
|
# Start tmux
|
|
SSH_AUTH_SOCK=/tmp/ssh-agent.sock tmux
|