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"
-
-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)"
Step 3: Add Your SSH Key to the Agent
ssh-add ~/.ssh/id_ed25519
Step 4: Copy and Add Your Public Key to GitHub
cat ~/.ssh/id_ed25519.pub
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
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
Add:
Host github.com
IdentityFile ~/.ssh/id_ed25519
AddKeysToAgent yes
Save and exit.
Step 7: Re-Test SSH Connection
Run:
ssh -T git@github.com
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
Step 2: Install GNOME Keyring
Using an AUR helper like paru
:
paru -S gnome-keyring
Step 3: Create an Autostart Entry
Edit or create an autostart file:
nano ~/.config/autostart/gnome-keyring-ssh.desktop
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
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)
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
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
- 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
- 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. π
Top comments (0)