SSH - Copy public key to remote server

Опубликовано: 20 Июнь 2026
на канале: Goran Vasić
23,089
81

Make sure to watch with Subtitles/CC turned ON.

Generate key pair:
$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/yourkey -C "[email protected]"

Copy key:
$ ssh-copy-id -i /path/to/your-private-key remoteuser@remotehost

SSH using your private key:
$ ssh -i /path/to/your-private-key remoteuser@remotehost

If you create the key pair under a directory other than "~/.ssh/", then you can specify its location using the SSH config file. You can see how to do that in my previous SSH Basics video.