-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f873170
commit 9daa231
Showing
1 changed file
with
19 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,60 +2,29 @@ | |
order: 170 | ||
icon: passkey-fill | ||
--- | ||
|
||
# SSH | ||
# SSH Key Generation and Access | ||
|
||
## Setting Up SSH Client on Windows | ||
|
||
### Step 1: Install OpenSSH Client Feature | ||
### Install OpenSSH Client Feature | ||
|
||
Windows 10 and later versions include an optional feature called "OpenSSH Client" that you can install via the Settings app or PowerShell. | ||
|
||
1. **Using Settings App:** | ||
|
||
- Open Settings (Press `Windows key + I`), then go to "Apps" > "Optional Features". | ||
- Click on "Add a feature", search for "OpenSSH Client", and click "Install". | ||
|
||
2. **Using PowerShell:** | ||
|
||
- Open PowerShell as an administrator. | ||
- Run the following command: | ||
```powershell | ||
Add-WindowsCapability -Online -Name OpenSSH.Client | ||
``` | ||
### Step 2: Generate SSH Key Pair | ||
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: | ||
```powershell | ||
ssh-keygen -t rsa -b 4096 -C "[email protected]" | ||
``` | ||
|
||
This command will prompt you to choose a location to save the key pair and optionally set a passphrase. | ||
|
||
### Step 3: Copy Public Key to Remote Server | ||
|
||
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. | ||
|
||
### Step 4: Test SSH Connection | ||
|
||
You can now test your SSH connection to the remote server using the `ssh` command in PowerShell: | ||
|
||
```powershell | ||
ssh username@remote_host | ||
``` | ||
|
||
If everything is set up correctly, you should be logged in to the remote server without being prompted for a password. | ||
|
||
### Step 5: Optional Configuration | ||
|
||
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. | ||
|
||
|
||
You're all set! You can now securely connect to remote servers using SSH without having to enter a password each time. | ||
|
||
## Setting Up SSH Client on Linux | ||
### Step 1: Install OpenSSH | ||
### Install the OpenSSH client | ||
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: | ||
|
@@ -64,27 +33,33 @@ sudo apt-get update | |
sudo apt-get install openssh-client | ||
``` | ||
|
||
### Step 2: Generate SSH Key Pair | ||
## Generating a personal key and using SSH | ||
|
||
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: | ||
### Step 1: Generate SSH Key Pair | ||
|
||
```bash | ||
ssh-keygen -t rsa -b 4096 -C "[email protected]" | ||
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: | ||
|
||
```powershell | ||
ssh-keygen -t ed25519 -C "[email protected]" | ||
``` | ||
|
||
This command will prompt you to choose a location to save the key pair and optionally set a passphrase. | ||
|
||
### Step 3: Copy Public Key to Remote Server | ||
### Step 2: Copy Public Key to Remote Server | ||
|
||
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: | ||
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. | ||
|
||
This command will prompt you to choose a location to save the key pair and optionally set a passphrase. | ||
|
||
Replace `username` and `remote_host` with your username and the hostname or IP address of the remote server: | ||
|
||
```bash | ||
ssh-copy-id username@remote_host | ||
``` | ||
|
||
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. | ||
|
||
### Step 4: Test SSH Connection | ||
### Step 3: Test SSH Connection | ||
|
||
You can now test your SSH connection to the remote server using the following command: | ||
|
||
|
@@ -94,9 +69,8 @@ ssh username@remote_host | |
|
||
If everything is set up correctly, you should be logged in to the remote server without being prompted for a password. | ||
|
||
### Step 5: Optional Configuration | ||
### Step 4: Optional Configuration | ||
|
||
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. | ||
|
||
|
||
You're all set! You can now securely connect to remote servers using SSH without having to enter a password each time. |