DEV Community

Jakariya Abbas
Jakariya Abbas

Posted on • Edited on

Effortless GitHub SSH Authentication on Arch Linux (XFCE) using GNOME Keyring (GPG Agent)

Enhance your workflow with secure, password-free GitHub authentication on Arch Linux. This guide walks you through setting up SSH keys and seamlessly integrating GNOME Keyring for a hassle-free experience on XFCE.


Part 1: Setting Up SSH with GitHub

Step 1: Generate an SSH Key

Run the following command to generate a new SSH key:

ssh-keygen -t ed25519 -C "user@arch.linux"
Enter fullscreen mode Exit fullscreen mode
  • -t ed25519: Uses the secure Ed25519 algorithm.
  • -C "user@arch.linux": Labels the key with your email.

Follow the prompts to save the key (default location: ~/.ssh/id_ed25519).

Step 2: Start the SSH Agent

To manage SSH keys in memory, start the SSH agent:

eval "$(ssh-agent -s)"
Enter fullscreen mode Exit fullscreen mode

Step 3: Add Your SSH Key to the Agent

ssh-add ~/.ssh/id_ed25519
Enter fullscreen mode Exit fullscreen mode

Step 4: Copy and Add Your Public Key to GitHub

cat ~/.ssh/id_ed25519.pub
Enter fullscreen mode Exit fullscreen mode

Copy the output and go to GitHub → Settings → SSH and GPG keys → New SSH Key, paste it, and save.

Step 5: Test Your SSH Connection

ssh -T git@github.com
Enter fullscreen mode Exit fullscreen mode

A successful connection returns a GitHub welcome message.

Step 6: Configure SSH (Optional)

To avoid manually specifying the SSH key, create a configuration file:

touch ~/.ssh/config
nano ~/.ssh/config
Enter fullscreen mode Exit fullscreen mode

Add:

Host github.com  
  IdentityFile ~/.ssh/id_ed25519  
  AddKeysToAgent yes  
Enter fullscreen mode Exit fullscreen mode

Save and exit.

Step 7: Re-Test SSH Connection

Run:

ssh -T git@github.com
Enter fullscreen mode Exit fullscreen mode

Your SSH setup is now complete!


Part 2: Enabling GNOME Keyring for Passwordless SSH on Arch XFCE

To have your SSH keys unlocked automatically at login, configure GNOME Keyring.

Step 1: Disable XFCE's Default SSH Agent

Run:

xfconf-query --channel xfce4-session --property /startup/ssh-agent/enabled --create --type bool --set false
Enter fullscreen mode Exit fullscreen mode

Step 2: Install GNOME Keyring

Using an AUR helper like paru:

paru -S gnome-keyring seahorse
Enter fullscreen mode Exit fullscreen mode

This provides gpg-agent, which will act as your SSH agent.


Step 3: Set the SSH_AUTH_SOCK Environment Variable

The SSH_AUTH_SOCK environment variable tells SSH tools where to find the authentication agent. Since GPG agent is being used as the SSH agent, this variable must point to its socket:

export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
Enter fullscreen mode Exit fullscreen mode

To make this change persistent across reboots, add this line to your ~/.bashrc or ~/.zshrc file.


Step 5: Add Your SSH Key to the Agent

Now that GPG agent is running with SSH support, add your SSH key:

ssh-add ~/.ssh/id_ed25519
Enter fullscreen mode Exit fullscreen mode
  • If your key has a passphrase, you will be prompted.
  • The passphrase will be cached according to GPG agent settings.

Step 7: Verify the Key Is Loaded

To confirm that your key has been added successfully, run:

ssh-add -l
Enter fullscreen mode Exit fullscreen mode
  • If your key is listed, it means GPG agent is managing it correctly.
  • If no keys appear, ensure that GPG agent is running and SSH_AUTH_SOCK is set correctly.

Your SSH keys are now managed by GNOME Keyring (GPG Agent), providing a secure and consistent authentication experience. 🎉

Top comments (0)