Log in to a linux server by using an SSH private Key from a linux terminal session Print

  • ssh terminal key
  • 35

To achieve this you need an SSH Client that is installed on your linux machine, a text editor like vim and your private key in openssh format.

Create a file in which to store your private key and edit it with vim to paste the key into it

vim examplekey.txt

When the editor starts press i to turn on insert mode.
Paste your key and save pressing ESC and typing :wq to write the file and return to commandline.

Afterwards change file permissons to 600

chmod 600 examplekey.txt

Now you can login to the linux remote server

ssh -i examplekey.txt root@remoteIP

When you are prompted to confirm the connection type yes and press enter.

That's it.


Was this answer helpful?

« Back