openssh wiki post

This commit is contained in:
Anton McClure 2020-07-02 16:38:34 -04:00
parent 87c166e337
commit 5987732e21
No known key found for this signature in database
GPG Key ID: 95F468320CF39788
1 changed files with 138 additions and 0 deletions

138
wiki/pages/openssh.md Normal file
View File

@ -0,0 +1,138 @@
---
published: true
title: OpenSSH Basics
author: Anton McClure, Jake Walker
---
Unlike antonmcclure.com, most of the interaction with Summit, Tilde.pw, and other UNIX/Linux systems are done with a tool known as SSH. This tool provides a direct connection from your device to a remote device. The text-based interface you are presented with, where commands would be given at, is referred to the shell (hence the name **S**ecure **Sh**ell. the *secure* part comes from the connection being encrypted so nobody can spy on the connection.
Summit, and many other servers with SSH access, use ssh keys rather than passwords. Passwords are insecure and can be very hard to manage. Using key-based authentication adds another layer of security to your accounts and makes the sysadmins job easier since ssh keys are easier to manage than passwords.
## How to Make an SSH Key Pair
SSH supports several key types. The most common are [ED25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) [RSA](https://en.wikipedia.org/wiki/RSA_(cryptosystem))
RSA is the de-facto standard for SSH and is supported nearly everywhere, however, more and more modern systems are now offering support for ED25519 keys.
***Note: Be sure to NEVER share your private key with anyone. Summit staff will NEVER ask for a private key when resolving an issue.***
### Windows 10
Windows 10 1809 or later has OpenSSH built in, so you need to install third-party tools.
If OpenSSH is not enabled, please see Microsofts documentation on
[OpenSSH in Windows](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview)
#### Generating Your Keypair
1. Open Microsoft PowerShell
2. Create your .ssh directory
```
mkdir .ssh
```
3. Create your keypair
a. RSA Key:
```
ssh-keygen -t rsa -b 4096
```
b. ED25519 Key:
```
ssh-keygen -t ed25519 -a 100
```
4. If you press enter to accept the defaults, your public and private keys will be located at `%UserProfile%\.ssh\id_rsa.pub` and
`%UserProfile%\.ssh\id_rsa` for RSA keys, or `%UserProfile%\.ssh\id_ed25519.pub` and `%UserProfile%\.ssh\id_ed25519` for ED25519 keys
5. To get your public key, run type `%UserProfile%\.ssh\id_rsa.pub` or type `%UserProfile%\.ssh\id_ed25519.pub` depending on your key type.
6. Copy the output and paste it in the appropriate place, whether it be an authorized_keys file, vps creation form, or a shell service signup form.
### macOS
macOS, the most popular UNIX operating system, has OpenSSH built in. SSH is enabled by default as a part of the operating system.
#### Generating Your Keypair
1. Open Terminal
2. Create your .ssh directory
```
mkdir .ssh
```
3. Create your keypair
a. RSA Key:
```
ssh-keygen -t rsa -b 4096
```
b. ED25519 Key:
```
ssh-keygen -t ed25519 -a 100
```
4. If you press enter to accept the defaults, your public and private keys will be located at `~/.ssh/id_rsa.pub` and
`~/.ssh/id_rsa` for RSA keys, or `~/.ssh/id_ed25519.pub` and `~/.ssh/id_ed25519` for ED25519 keys
5. To get your public key, run type `~/.ssh/id_rsa.pub` or type `~/.ssh/id_ed25519.pub` depending on your key type.
6. Copy the output and paste it in the appropriate place, whether it be an authorized_keys file, vps creation form, or a shell service signup form.
### UNIX/Linux (Other)
Similarly to macOS, most UNIX systems such as Oracle Solaris, IBM AIX, HP-UX, and Linux systems such as Ubuntu have OpenSSH built in, and enabled by default.
**Linux users:** if your distro doesnt have SSH installed, look up how to install OpenSSH on your distro.
#### Generating Your Keypair
1. Open your preferred terminal emulator or Console/TTY1-6
2. Create your .ssh directory
```
mkdir .ssh
```
3. Create your keypair
a. RSA Key:
```
ssh-keygen -t rsa -b 4096
```
b. ED25519 Key:
```
ssh-keygen -t ed25519 -a 100
```
4. If you press enter to accept the defaults, your public and private keys will be located at `~/.ssh/id_rsa.pub` and
`~/.ssh/id_rsa` for RSA keys, or `~/.ssh/id_ed25519.pub` and `~/.ssh/id_ed25519` for ED25519 keys
5. To get your public key, run type `~/.ssh/id_rsa.pub` or type `~/.ssh/id_ed25519.pub` depending on your key type.
6. Copy the output and paste it in the appropriate place, whether it be an authorized_keys file, vps creation form, or a shell service signup form.
### How to Connect with SSH
#### Windows 10
1. Open PowerShell
2. Run `ssh <username>@<hostname> -i C:\Users\<LocalUsername>\.ssh\id_rsa` or ssh `<username>@<hostname> -i C:\Users\<LocalUsername>\.ssh\id_ed25519`
3. Enjoy SSH
#### macOS
1. Open PowerShell
2. Run `ssh <username>@<hostname> -i ~/.ssh/id_rsa` or ssh `<username>@<hostname> -i ~/.ssh/id_ed25519`
3. Enjoy SSH
#### UNIX/Linux (Other)
1. Open PowerShell
2. Run `ssh <username>@<hostname> -i ~/.ssh/id_rsa` or ssh `<username>@<hostname> -i ~/.ssh/id_ed25519`
3. Enjoy SSH
### Putty Users
If you are attempting to connect to SSH with PuTTY, you'll need to follow the [PuTTY guide](/guides/putty)