1
0
2025-04-18 17:12:50 -06:00
--
2025-04-18 17:12:50 -06:00

HOW TO INTO SSH

SSH is a secure connection tool, usually allowing authorized remote execution. You need a public and private key generated by a command. This key is used for facilitating secure connections.

SSH has several important files:

  • .ssh/config <- On this later
  • .ssh/key (a private key, don't send this to anyone for any reason), and .ssh/key.pub (a PUBlic key, distribute as you wish)
  • .ssh/known_hosts <- Records of prior connections, may be invalidated or deleted . .ssh/authorized_keys <- list of public keys (literally cat of the .pub) allowed to SSH into this user, never provided by default

Generating Le Key

There are types of keys, older keys are RSA, newer are ED25519, use ED25519 if you can.

Apart from that the process is simple and a single command. You can either copy keys from device to device, or generate new keys for each one. Don't forget to add them to your accounts or whatever you want to access.

Here is an example that'll work for a first-key:

$ ssh-keygen -t ed25519
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/emil/.ssh/id_ed25519): <RET> # If you change this you have to do the full path without expansion iirc
Enter passphrase for "/home/emil/.ssh/id_ed25519" (empty for no passphrase): <RET>
Enter same passphrase again: <RET>
Your identification has been saved in /home/emil/.ssh/id_ed25519
Your public key has been saved in /home/emil/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA emil@box # obvious this will be your user@host
The key's randomart image is:
+--[ED25519 256]--+
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
|AAAAAAAAAAAAAAAAA|
+----[SHA256]-----+
$ # All done...

Then add your .pub key to an account or another devices user.

SSH URIs look like this:

  • user@box[:/path/file] [-p|ort| number]
  • ssh://user@box[:port][/path/file] # preferred

Making a connection

ssh user@box -i ~/.ssh/key # as in the private key, not the public
-- Blah Blah Blah new connection will be added to .ssh/known_hosts
-- say YES.

If you encounter a screaming message about a potential Man In The Middle, it is usually caused by some dramatic change to the remote system. If you changed the remote sshd configuration or suspect that is the case, then it would be generally safe to ignore the alert.

You can see the actual ssh(1) for exact usage and what else you can do.

config

This is actually important if you don't want to peel your eyes out.

Lets say your key is called xolatile, this would be a sane configuration for git.xolatile.top:

File: ~/.ssh/config

Host git.xolatile.top
     IdentityFile ~/.ssh/xolatile
     User git

By default ssh uses your user (which is also the default connection user) to find the default public key.

hence, when you ssh somehost ssh will first look at your current user, and then look for and use the public key in ~user/.ssh/user unless specified via the -i option or by your config file.

You can also do wildcards, this is covered further in the ssh_config(5) manual page.

That's It

SSH has a lot of capabilities, but its best and most useful is simplicity.

Description
Xolatile can (not) into SSH
Readme 46 KiB