servermanagement:security
Differences
This shows you the differences between two versions of the page.
| servermanagement:security [2022/12/23 11:58] – created dimitrij | servermanagement:security [2022/12/23 12:12] (current) – dimitrij | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| * Follow the prompts to specify the location to save the key pair, and enter a passphrase for the private key (optional). | * Follow the prompts to specify the location to save the key pair, and enter a passphrase for the private key (optional). | ||
| * This will generate a public key and a private key in the specified location. The public key is stored in a file with the '' | * This will generate a public key and a private key in the specified location. The public key is stored in a file with the '' | ||
| + | - Copy the public key to the server: | ||
| + | * Enter the following command to copy the public key to the server, replacing '' | ||
| + | * '' | ||
| + | * You will be prompted to enter the password for the user on the server. | ||
| + | * This will copy the public key to the server and append it to the '' | ||
| - | Copy the public key to the server: | + | - Disable password-based authentication: |
| - | | + | * Edit the ''/ |
| - | ssh-copy-id user@server_hostname_or_IP | + | * Save the file and restart the SSH service by running the following command: '' |
| - | You will be prompted | + | - Test the key-based authentication: |
| - | This will copy the public | + | * From your local machine, try connecting |
| + | * '' | ||
| - | Disable password-based authentication: | + | If the connection is successful, you have successfully set up key-based authentication for the server' |
| - | Edit the / | + | |
| - | Save the file and restart the SSH service by running the following command: systemctl restart ssh | + | |
| - | + | ||
| - | Test the key-based authentication: | + | |
| - | From your local machine, try connecting to the server using the ssh command and the private key file: | + | |
| - | ssh -i / | + | |
| - | | + | |
servermanagement/security.1671793120.txt.gz · Last modified: 2022/12/23 11:58 by dimitrij