Good to know – ssh

Create keys:

ssh-keygen -t ed25519 \
-a 420 -f ~/.ssh/demo.ed25519 \
- C "Kommentar zum Key"

Copy public key to server:

ssh-copy-id \
-i ~/.ssh/demo.ed25519.pub \
user@server

Add private key to ssh-agent:

# ssh-agent
eval `ssh-agent -s`
ssh-add ~/.ssh/demo.ed25519
ssh-add -l

Autostart ssh agent:
# https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login/18915067#18915067
~/.config/systemd/user/ssh-agent.service


[Unit]
Description=SSH key agent

[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK

[Install]
WantedBy=default.target

export SSH_AUTH_SOCK=”$XDG_RUNTIME_DIR/ssh-agent.socket”
systemctl –user enable ssh-agent
systemctl –user start ssh-agent

Resources:
https://www.youtube.com/watch?v=qvdlLTyUJ5I
https://www.ssh.com/academy/ssh/keygen#creating-an-ssh-key-pair-for-user-authentication

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.