Docs about sshs config file

This commit is contained in:
2025-01-21 13:41:40 +01:00
parent 0d5d261cde
commit 30512b6a8b

View File

@@ -0,0 +1,45 @@
# SSH config files
## brief
This is the first time for me using ssh config files so that's why this is a seperate file.
## What can you do with ssh config files
In SSH config files you can describe how connections should be handled and with which keys you want to use to log in onto a specific server and much more.
## How is a config file structured
```config
Host hostname1
SSH_OPTION value
SSH_OPTION value
Host hostname2
SSH_OPTION value
Host *
SSH_OPTION value
```
A entry always start with `Host` and then the name you wanna give to that host. After that you press enter and then tab. Now you can define the options for the ssh connections.
Example:
```config
HOST gitwaag
Hostname gitlab.waag.org
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
```
In this config I defined the host as gitwaag. So I can connect to it using the command ```ssh gitwaag``` instead of ```ssh gitlab.waag.org```.
#### Explanation of the parameters used in this config above
* `Hostname` Defines the hostname/domain of the server
* `User` The username you wanna log in as on the server
* `IdentityFile` Which public key you want to use for the connection
* `IdentitiesOnly` Set it to only use the IdentityFile instead of other authentication files.
## Sources:
* https://linuxize.com/post/using-the-ssh-config-file/
* https://phoenixnap.com/kb/ssh-config