User Tools

Site Tools


servermanagement:security

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

servermanagement:security [2022/12/23 11:58] – created dimitrijservermanagement: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 ''.pub'' extension, and the private key is stored in a file with no extension.     * This will generate a public key and a private key in the specified location. The public key is stored in a file with the ''.pub'' extension, and the private key is stored in a file with no extension.
 +  - Copy the public key to the server:
 +    * Enter the following command to copy the public key to the server, replacing ''user'' with the username on the server and server_hostname_or_IP with the hostname or IP address of the server:
 +    * ''ssh-copy-id user@server_hostname_or_IP''
 +    * 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 ''authorized_keys'' file in the ''~/.ssh'' directory of the user's home directory on the server.
  
-    Copy the public key to the server+  - Disable password-based authentication
-        Enter the following command to copy the public key to the server, replacing user with the username on the server and server_hostname_or_IP with the hostname or IP address of the server: +    * Edit the ''/etc/ssh/sshd_config'' file on the server and set the ''PasswordAuthentication'' option to no. This will disable password-based authentication for the SSH service on the server. 
-        ssh-copy-id user@server_hostname_or_IP +    * Save the file and restart the SSH service by running the following command: ''systemctl restart ssh'' 
-        You will be prompted to enter the password for the user on the server. +  - Test the key-based authentication: 
-        This will copy the public key to the server and append it to the authorized_keys file in the ~/.ssh directory of the user's home directory on the server.+    * From your local machine, try connecting to the server using the ssh command and the private key file
 +    * ''ssh -i /path/to/private_key user@server_hostname_or_IP''
  
-    Disable password-based authentication: +If the connection is successful, you have successfully set up key-based authentication for the server's SSH service.
-        Edit the /etc/ssh/sshd_config file on the server and set the PasswordAuthentication option to no. This will disable password-based authentication for the SSH service on the server. +
-        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 /path/to/private_key user@server_hostname_or_IP +
-        If the connection is successful, you have successfully set up key-based authentication for the server's SSH service.+
servermanagement/security.txt · Last modified: 2022/12/23 12:12 by dimitrij

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki