summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2016-12-23 01:07:53 +0200
committerYuval Adam <_@yuv.al>2016-12-23 01:07:53 +0200
commit41bc1b1ddba06de65f3bfec6b9b0c17f93f21aac (patch)
tree08c92167cb159c9d7f82659cf5f3a4ff829b74e6
parentfe3c62cd3477ae524346ee0d3ded90899923386d (diff)
Switch to systemd unit based SSH agent
-rw-r--r--.bash_profile1
-rw-r--r--.bashrc2
-rw-r--r--.config/systemd/user/ssh-agent.service10
3 files changed, 12 insertions, 1 deletions
diff --git a/.bash_profile b/.bash_profile
index 0006ff8..efac808 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -2,6 +2,5 @@
# ~/.bash_profile
#
-eval `ssh-agent`
[[ -f ~/.bashrc ]] && . ~/.bashrc
diff --git a/.bashrc b/.bashrc
index f4845b0..c8ad744 100644
--- a/.bashrc
+++ b/.bashrc
@@ -8,3 +8,5 @@
alias ls='ls --color=auto'
alias ll='ls -la'
PS1='[\u@\h \W]\$ '
+
+export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
diff --git a/.config/systemd/user/ssh-agent.service b/.config/systemd/user/ssh-agent.service
new file mode 100644
index 0000000..87d6c04
--- /dev/null
+++ b/.config/systemd/user/ssh-agent.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=SSH key agent
+
+[Service]
+Type=forking
+Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
+ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK
+
+[Install]
+WantedBy=default.target