SSH Tips

by Scott, Revised on January 8, 2016 (Linux)

SSH Key Generation

Generate ssh key (-C is a comment, tacked on to the end of your public key).

cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C ''

Integration with Kwallet

Install ksshaskpass:

sudo apt-get install ksshaskpass

Use ssh-add to add key indentities to ssh-agent (part of the openssh-client package). The "</dev/null" forces ssh-add a null input, therefore prompting ksshaskpass to use a GUI pop up to request the passphrase along with a remember checkbox. If checked, then passphrase is stored in Kwallet. The first command below will look for private keys of certain names (see man page) and the second a specific key.

ssh-add </dev/null
ssh-add ~/.ssh/private_key </dev/null

Create a Bash script (~/bin/ or on KDE start up ~/.kde/Autostart/

ssh-add </dev/null
ssh-add ~/.ssh/private_key </dev/null

This method stopped working after a Kubuntu update, but I found a solution on this page by removing a package that is apparently not needed.

sudo aptitude purge gcr

Remote Host

Copy your key (or keys) to a remote host:

ssh-copy-id -i ~/.ssh/

More Than Adding

ssh-add - Adds private key identities to the authentication agent.

Lists fingerprints of all identities currently represented by the agent.

ssh-add -l

Deletes all identities from the agent.

ssh-add -D

Tags: Linux