|
1 | 1 | ---
|
2 |
| -order: 30 |
| 2 | +order: 170 |
3 | 3 | icon: passkey-fill
|
4 | 4 | ---
|
5 | 5 |
|
6 | 6 | # SSH
|
7 | 7 |
|
8 |
| -## How to use SSH Keys on TurboStack |
| 8 | +## Setting Up SSH Client on Windows |
9 | 9 |
|
10 |
| -### Windows Users |
11 |
| -Don't - haha |
| 10 | +### Step 1: Install OpenSSH Client Feature |
12 | 11 |
|
13 |
| -### Linux Users |
| 12 | +Windows 10 and later versions include an optional feature called "OpenSSH Client" that you can install via the Settings app or PowerShell. |
| 13 | + |
| 14 | +1. **Using Settings App:** |
| 15 | + - Open Settings (Press `Windows key + I`), then go to "Apps" > "Optional Features". |
| 16 | + - Click on "Add a feature", search for "OpenSSH Client", and click "Install". |
| 17 | + |
| 18 | +2. **Using PowerShell:** |
| 19 | + - Open PowerShell as an administrator. |
| 20 | + - Run the following command: |
| 21 | + ```powershell |
| 22 | + Add-WindowsCapability -Online -Name OpenSSH.Client |
| 23 | + ``` |
| 24 | +
|
| 25 | +### Step 2: Generate SSH Key Pair |
| 26 | +
|
| 27 | +If you haven't already generated an SSH key pair, you can do so using the `ssh-keygen` command in PowerShell. Run the following command: |
| 28 | +
|
| 29 | +```powershell |
| 30 | +ssh-keygen -t rsa -b 4096 -C "[email protected]" |
| 31 | +``` |
| 32 | + |
| 33 | +This command will prompt you to choose a location to save the key pair and optionally set a passphrase. |
| 34 | + |
| 35 | +### Step 3: Copy Public Key to Remote Server |
| 36 | + |
| 37 | +Once the key pair is generated, you need to copy the public key to the remote server. You can use tools like `ssh-copy-id` or manually copy the public key. |
| 38 | + |
| 39 | +### Step 4: Test SSH Connection |
| 40 | + |
| 41 | +You can now test your SSH connection to the remote server using the `ssh` command in PowerShell: |
| 42 | + |
| 43 | +```powershell |
| 44 | +ssh username@remote_host |
| 45 | +``` |
| 46 | + |
| 47 | +If everything is set up correctly, you should be logged in to the remote server without being prompted for a password. |
| 48 | + |
| 49 | +### Step 5: Optional Configuration |
| 50 | + |
| 51 | +You can configure your SSH client by editing the `~/.ssh/config` file. This file allows you to set options such as default usernames, identities, and SSH server configurations. |
| 52 | + |
| 53 | + |
| 54 | +You're all set! You can now securely connect to remote servers using SSH without having to enter a password each time. |
| 55 | + |
| 56 | +## Setting Up SSH Client on Linux |
| 57 | + |
| 58 | +### Step 1: Install OpenSSH |
| 59 | + |
| 60 | +Make sure OpenSSH client is installed on your Linux system. If not installed, you can install it using your package manager. For example, on Ubuntu or Debian-based systems, you can use: |
| 61 | + |
| 62 | +```bash |
| 63 | +sudo apt-get update |
| 64 | +sudo apt-get install openssh-client |
| 65 | +``` |
| 66 | + |
| 67 | +### Step 2: Generate SSH Key Pair |
| 68 | + |
| 69 | +If you haven't already generated an SSH key pair, you can do so using the `ssh-keygen` command. Run the following command in your terminal: |
| 70 | + |
| 71 | +```bash |
| 72 | +ssh-keygen -t rsa -b 4096 -C "[email protected]" |
| 73 | +``` |
| 74 | + |
| 75 | +This command will prompt you to choose a location to save the key pair and optionally set a passphrase. |
| 76 | + |
| 77 | +### Step 3: Copy Public Key to Remote Server |
| 78 | + |
| 79 | +Once the key pair is generated, you need to copy the public key to the remote server. You can use the `ssh-copy-id` command for this. Replace `username` and `remote_host` with your username and the hostname or IP address of the remote server: |
| 80 | + |
| 81 | +```bash |
| 82 | +ssh-copy-id username@remote_host |
| 83 | +``` |
| 84 | + |
| 85 | +You'll be prompted to enter your password on the remote server. Once authenticated, your public key will be added to the `~/.ssh/authorized_keys` file on the remote server. |
| 86 | + |
| 87 | +### Step 4: Test SSH Connection |
| 88 | + |
| 89 | +You can now test your SSH connection to the remote server using the following command: |
| 90 | + |
| 91 | +```bash |
| 92 | +ssh username@remote_host |
| 93 | +``` |
| 94 | + |
| 95 | +If everything is set up correctly, you should be logged in to the remote server without being prompted for a password. |
| 96 | + |
| 97 | +### Step 5: Optional Configuration |
| 98 | + |
| 99 | +You can configure your SSH client by editing the `~/.ssh/config` file. This file allows you to set options such as default usernames, identities, and SSH server configurations. |
| 100 | + |
| 101 | + |
| 102 | +You're all set! You can now securely connect to remote servers using SSH without having to enter a password each time. |
0 commit comments