mirror of
https://github.com/elAgala/server-initializer.git
synced 2026-02-14 05:06:18 +00:00
Add docs + .sh files
This commit is contained in:
34
create_ssh_key.md
Normal file
34
create_ssh_key.md
Normal file
@@ -0,0 +1,34 @@
|
||||
## Creating and Using SSH Keys
|
||||
|
||||
### Understanding SSH Keys
|
||||
SSH keys provide a secure method for authenticating to remote servers. They consist of a public key and a private key. The public key is shared with the server, while the private key remains on your local machine.
|
||||
|
||||
### Generating an SSH Key Pair
|
||||
|
||||
To generate a new SSH key pair, open your terminal and run the following command:
|
||||
```bash
|
||||
ssh-keygen -t ed25519 -C "your_email@example.com"
|
||||
```
|
||||
Replace your_email@example.com with your actual email address.
|
||||
You will be prompted to enter a passphrase for added security. It's recommended to use a strong passphrase. Store this passphrase as it will be one of our login methods.
|
||||
|
||||
The generated keys will be stored in the following files:
|
||||
|
||||
Private key: ~/.ssh/id_ed25519
|
||||
Public key: ~/.ssh/id_ed25519.pub
|
||||
|
||||
### Adding Your Public Key to the Server
|
||||
|
||||
1. Copy the contents of the public key file:
|
||||
|
||||
2. On your server, log in as the user you created.
|
||||
|
||||
3. Create the .ssh directory: mkdir -p ~/.ssh
|
||||
|
||||
4. Create the authorized_key file:touch ~/.ssh/authorized_keys
|
||||
|
||||
5. Set permissions:
|
||||
```bash
|
||||
chmod 700 ~/.ssh
|
||||
chmod 600 ~/.ssh/authorized_keys
|
||||
```
|
||||
Reference in New Issue
Block a user