ssh
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| ssh [2022/12/21 11:18] – dimitrij | ssh [2022/12/23 10:12] (current) – removed dimitrij | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== SSH Konfiguration ====== | ||
| - | In diesem intrag soll es um die Grundlegende SSH Konfiguration gehen. Ausgegangen wird von der initialen Einrichtung eines Server wie [[Server buchen|hier]] beschrieben. Daher werden einige Abschnitte bei anderen Grundvorraussetzungen optional und können übersprungen werden. | ||
| - | ===== Initial Connection ===== | ||
| - | Wenn auf dem Server SSH eingerichtet ist, so werden die Stadard Einstellungen genutzt. Eine Verbindung kann daher mit dem folgenden Befehlt erfolgen: | ||
| - | |||
| - | '' | ||
| - | |||
| - | **Es empfiehlt sich immer eine zusätzliche Verbindung aufzubauen, welche als Backup genutzt werden kann, wenn man sich bei Fehlern aus dem System aussperrt** | ||
| - | |||
| - | Hat man nun zwei Terminals geöffnet, so kann man eines der Beiden dazu Nutzen die Konfiguration vorzunehmen. | ||
| - | |||
| - | == Creating a user on a Linux machine and securing the connection with a private key == | ||
| - | |||
| - | 1. Log in to your Linux machine as a user with sudo privileges. | ||
| - | |||
| - | 2. Run the `adduser` command to create a new user. Replace `USERNAME` with the desired username: | ||
| - | |||
| - | '' | ||
| - | |||
| - | 3. Follow the prompts to set the user's password and other information. | ||
| - | |||
| - | 4. To allow the new user to log in using a private key, you will need to generate a public/ | ||
| - | |||
| - | '' | ||
| - | |||
| - | 5. Press `Enter` to accept the default location and file name for the key pair. You will be prompted to enter a passphrase for the key. It is highly recommended to use a strong, unique passphrase to protect your key. | ||
| - | |||
| - | 6. Once the key pair is generated, you can view the public key by running the following command: | ||
| - | |||
| - | '' | ||
| - | |||
| - | 7. Copy the output of the `cat` command, which is your public key. | ||
| - | |||
| - | 8. Switch to the new user's account by running the following command: | ||
| - | |||
| - | '' | ||
| - | |||
| - | 10. Open a new file in the `.ssh` directory called `authorized_keys` using a text editor, such as `nano`: | ||
| - | |||
| - | '' | ||
| - | |||
| - | 11. Paste the public key that you copied earlier into the `authorized_keys` file. | ||
| - | |||
| - | 12. Save and close the file. | ||
| - | |||
| - | 13. Set the correct permissions on the `.ssh` directory and `authorized_keys` file to protect them from unauthorized access: | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | 14. Exit the new user's account by running the `exit` command. | ||
| - | |||
| - | 15. You should now be able to log in to the new user's account using the private key. To do so, run the following command from your local machine, replacing `USERNAME` with the username of the new user and `HOSTNAME` with the hostname or IP address of the Linux machine: | ||
| - | |||
| - | '' | ||
| - | |||
| - | |||
| - | You will be prompted to enter the passphrase for the private key. Once you enter the correct passphrase, you should be logged in to the new user's account on the Linux machine. | ||
| - | |||
| - | ===== sshd_config ===== | ||
| - | |||
| - | Leider ist die Konfiguration je nach Betriebssystem anders untergebracht. Für gewöhnlich findet man diese jedoch unter ''/ | ||
| - | |||
| - | Das Konfigurationsfile hat viele Optionen und daher erhebt die Nachfolgende Liste keinen Anspruch auf vollständigkeit. Die Zeilen sind zudem meist auskommentiert, | ||
| - | |||
| - | * '' | ||
| - | * '' | ||
ssh.1671617913.txt.gz · Last modified: 2022/12/21 11:18 by dimitrij