Skip to content

Commit

Permalink
Fix SSH agent startup and key addition
Browse files Browse the repository at this point in the history
  • Loading branch information
HassanNawazHiraj committed Feb 16, 2024
1 parent dfadf3a commit 8dd13b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions start-ssh-server.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash

if ! pgrep -q ssh-agent; then
if ! pgrep -x "ssh-agent" > /dev/null; then
eval "$(ssh-agent -s)"
fi

# add all the keys to the agent
for key in ~/.ssh/*; do
chmod 600 $key > /dev/null
ssh-add $key > /dev/null
done
done

echo "SSH agent started and all keys added."

0 comments on commit 8dd13b3

Please sign in to comment.