SSH

last edited Sat, 20 Jul 2024 12:26:17 GMT
backlinks: rsync


SSH (Secure Shell)

generating ssh-keys direct link to this section

ssh-keygen -o

ssh-keygen -t ed25519

It is using an elliptic curve signature scheme, which offers better security than ECDSA and DSA. At the same time, it also has good performance.

checking for existing keys direct link to this section

lzrd@DESKTOP-B0F3S53:~$ ls -la .ssh if there isn't a .ssh directory then you can just make it mkdir .ssh

host name alias direct link to this section

A good way to save time. Edit this in ../.ssh/ssh_conf

copying your pub key to a remote server direct link to this section

ssh-copy-id sammy@your_server_address

ssh-copy-id -i ~/.ssh/mykey.pub user@host

never import a private key to another machine!

common issues direct link to this section

(public key denied) Sometimes you may need to specify the proper private key to unlock the public key gave out. This occurs if you have tons of different private keys. Oops.

ssh -i .ssh/envs_win envs.net

Alternatively:

ssh -o "IdentitiesOnly=yes" -i <private key filename> <hostname>

Debugging direct link to this section

You can use the -v flag to run in verbose mode.

Aliases direct link to this section

Edit the file in .ssh/config

Host ubserver
    Hostname 127.0.0.1
    Port 2222
    User george

to ssh simply use ssh ubserver

Backups direct link to this section

ID private key and copy the private key ID (number sequence after the slash)

gpg --list-secret-keys --keyid-format LONG

Export the private key before copying to a USB drive

gpg --export-secret-keys $ID > my-private-key.asc

Restoring direct link to this section

 exec ssh-agent bash

add key to ssh-agent

ssh-add ~/.ssh/id_rsa

Import key:

 gpg --import my-private-key.asc

References direct link to this section

ssh keys ssh manual