Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The client should now be able to connect via SSH to the openssh server.

Generating a (new) separate key and using it for a specific host

You might want to use a separate key for a specific host.  For example, let's create a key called gitlab_jaytaala for use with in pushing/pulling to/from gitlab.jaytaala.com:

Code Block
ssh-keygen -t rsa -f .ssh/gitlab_jaytaala

To get your machine to use this key for a specific host (for example from the terminal) we create an the following config file within your .ssh folder:

Code Block
vim .ssh/config

and add the following:

Code Block
title.ssh/config
Host gitlab_jay 
    HostName gitlab.jaytaala.com
    IdentityFile ~/.ssh/gitlab_jaytaala
    User j.taala

You can add another section as above for other hosts.  Note that indentation is not required (but does make it much easier to read given lots of Host directives).

In the above example, having defined the host gitlab_jay  we can then simply do:

Code Block
ssh gitlab_jay

to connect by ssh to host gitlab.jaytaala.com. 

References

  1. https://help.ubuntu.com/lts/serverguide/openssh-server.html
  2. https://linuxize.com/post/using-the-ssh-config-file/

Content by Label
showLabelsfalse
max5
spaces~j.taala
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("ubuntu","ssh") and type = "page" and space = "TKB"
labelsssh ubuntu

...