From: Emil Williams Date: Fri, 18 Apr 2025 16:34:48 +0000 (-0600) Subject: -- X-Git-Url: https://git.xolatile.top/?a=commitdiff_plain;h=6b6c58c2049ff60210f1141ed9a6edaa7c03ec08;p=emil-ssh.git -- --- 6b6c58c2049ff60210f1141ed9a6edaa7c03ec08 diff --git a/README.md b/README.md new file mode 100644 index 0000000..adb5814 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +### HOW TO INTO SSH ### + +SSH is a connection tool. +You need a public and private key generated by a command. + +SSH has several important files: + +- .ssh/config <- On this later +- .ssh/key (private) .ssh/key.pub +- .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: + +```sh +$ ssh-keygen -t ed25519 +Generating public/private ed25519 key pair. +Enter file in which to save the key (/home/emil/.ssh/id_ed25519): # 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): +Enter same passphrase again: +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 +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. + +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: + +```yaml +Host git.xolatile.top + IdentityFile ~/.ssh/model + 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 ```~user/.ssh/user``` unless specified via an option or by config. + +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 it's best and most useful is its simplicity.