SSH Tips

by Scott, Revised on April 12, 2019 (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 'comment'

Remote Host

Copy your key (or keys) to a remote host (with default and unique name):

ssh-copy-id user@example.com
ssh-copy-id -i ~/.ssh/publickey.pub user@example.com

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).

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

Create a Bash script (~/bin/my-ssh-add.sh or on KDE start up ~/.kde/Autostart/my-ssh-add.sh).

#!/bin/sh
ssh-add ~/.ssh/private_key </dev/null

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