Featured image of post Terminal

Terminal

SSH

Generate Private/Pub-Keys

Generate a Private/Pub-Key with et25519 and a Comment.

1
ssh-keygen -t ed25519 -f ~/.ssh/alican.ed25519 -C "Key for my homeserver"

Transfer the pub key to remote host. Typicall its located at

1
/home/$USERNAME/.ssh/
1
ssh-copy-id -i ~/.ssh/alican.ed25519.pub alican@example.com

If you the ssh keys manually, be sure that the files have the correct permissions:

1
2
chmod 700 .ssh
chmod 600 ~/.ssh/authorized_keys

Login SSH with an explicit key

1
ssh -i ~/.ssh/alican.ed25519 alican@example.com

Deaktivate password authentication. Open the config /etc/ssh/sshd_config and edit following lines like this:

1
2
PasswordAuthentication no
ChallengeResponseAuthentication no

Restart the SSH server to apply the changes

1
systemctl restart ssh

Save remote Hosts on your local client at ~/.ssh/config

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Host alican.de
     HostName alican.de
     User alican
     IdentityFile ~/.ssh/alican.ed25519

Host klipper
     HostName 192.168.178.42
     User pi
     Port 2000
     LocalForward 80 localhost:8080
     IdentityFile ~/.ssh/klipper.ed25519
     

Now just run the ssh command like this

1
ssh alican.de
comments powered by Disqus