til/Applications/Network/OpenSSH.md

977 B

OpenSSH

Distribution Package
Arch Linux openssh
Ubuntu openssh-client, openssh-server

Edit ~/.ssh/config:

Host myserver
    Hostname        server-address
    User            user
    Port            port
    IdentityFile    /path/to/private/key

Connect:

ssh -p port user@server-address
ssh myserver

SSH key

Remove keys in known_hosts:

# Remove all
rm -rf ~/.ssh/known_hosts

# Remove only 1
ssh-keygen -R remote_host

Copy local key to server

Generate key:

ssh-keygen -t rsa -b 4096 -C "your@email.com"

Start ssh-agent:

eval "$(ssh-agent -s)"

Add key:

ssh-add ~/.ssh/id_rsa

Confirm key has been added:

ssh-add -l

Copying public key to server:

ssh-copy-id -i ~/.ssh/id_rsa.pub user@server-address