servermanagement:ssh
Differences
This shows you the differences between two versions of the page.
| servermanagement:ssh [2022/12/23 10:13] – created dimitrij | servermanagement:ssh [2022/12/23 11:51] (current) – dimitrij | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== SSH Konfiguration | + | ====== SSH ====== |
| - | In diesem Eintrag 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 ===== | + | To connect to a Linux server using SSH (Secure Shell), you will need to have an SSH client installed on your computer. If you don't have an SSH client installed, you can install one such as OpenSSH or PuTTY. |
| - | Wenn auf dem Server | + | |
| - | '' | + | Once you have an SSH client installed, you can use the following steps to connect to a Linux server: |
| - | **Es empfiehlt sich immer eine zusätzliche Verbindung aufzubauen, welche als Backup genutzt werden kann, wenn man sich bei Fehlern aus dem System aussperrt** | + | - Open your SSH client. |
| + | - Enter the hostname or IP address of the Linux server you want to connect to in the " | ||
| + | - Enter the port number for the SSH service on the server (usually 22). | ||
| + | - Enter your username for the server in the " | ||
| + | - Click the " | ||
| - | Hat man nun zwei Terminals geöffnet, so kann man eines der Beiden dazu Nutzen die Konfiguration vorzunehmen. | + | If the server requires a password, you will be prompted to enter it. If the server uses key-based authentication, |
| - | == Creating | + | Once you have successfully connected to the server, you should see a command prompt where you can enter commands to interact with the server. |
| - | 1. Log in to your Linux machine as a user with sudo privileges. | + | ===== Terminal ===== |
| - | 2. Run the `adduser` command | + | When you are on a Mac oder Linux machine, you can use the terminal and connect |
| - | '' | + | '' |
| - | 3. Follow | + | Here is an overview of some of the most commonly used options for the ssh command, along with their syntax: |
| - | 4. To allow the new user to log in using a private key, you will need to generate a public/ | + | * '' |
| - | '' | + | * '' |
| - | 5. Press `Enter` | + | * '' |
| - | 6. Once the key pair is generated, you can view the public key by running | + | * '' |
| - | '' | + | * '' |
| - | + | ||
| - | 7. Copy the output | + | |
| - | + | ||
| - | 8. Switch | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | 10. Open a new file in the `.ssh` directory called `authorized_keys` | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | 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, | + | |
| - | + | ||
| - | * '' | + | |
| - | * '' | + | |
servermanagement/ssh.txt · Last modified: 2022/12/23 11:51 by dimitrij