DEV Community

jakariya
jakariya

Posted on

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

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
Enter fullscreen mode Exit fullscreen mode

Step 3: Create an Autostart Entry

Edit or create an autostart file:

nano ~/.config/autostart/gnome-keyring-ssh.desktop
Enter fullscreen mode Exit fullscreen mode

Paste:

[Desktop Entry]
Type=Application
Name=GNOME Keyring SSH Agent
Exec=/usr/bin/gnome-keyring-daemon --start --components=ssh
Comment=Unlock SSH keys on login
Enter fullscreen mode Exit fullscreen mode

Save and exit.

Step 4: Set the SSH_AUTH_SOCK Environment Variable

The SSH_AUTH_SOCK environment variable tells SSH tools where to find the authentication agent. GNOME Keyring manages its own SSH agent, so you must explicitly set this variable to point to its socket location:

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: Start GNOME Keyring Daemon for SSH

Start the GNOME Keyring daemon with the SSH component enabled:

/usr/bin/gnome-keyring-daemon --start --components=ssh
Enter fullscreen mode Exit fullscreen mode

This ensures that GNOME Keyring is managing your SSH keys.

Step 6: Add Your SSH Key to the Agent

Now that GNOME Keyring is running, add your SSH key to the agent:

ssh-add ~/.ssh/id_ed25519
Enter fullscreen mode Exit fullscreen mode
  • If your key has a passphrase, you will be prompted to enter it.
  • Once saved, GNOME Keyring will remember the passphrase and automatically unlock your key at login.

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 GNOME Keyring is managing it correctly.
  • If no keys appear, ensure that the SSH agent is running and that SSH_AUTH_SOCK is properly set.

Your SSH keys are now managed by GNOME Keyring, unlocking them automatically at login for a passwordless experience. πŸŽ‰

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post