Update einrichtung_client.sh
This commit is contained in:
@@ -1,7 +1,27 @@
|
|||||||
!/bin/bash
|
#!/bin/bash
|
||||||
apt install curl wget
|
rm /usr/local/bin/userkeys.sh
|
||||||
echo -e "PubkeyAuthentication yes \nPasswordAuthentication no \nAuthorizedKeysCommand /usr/local/bin/userkeys.sh \nAuthorizedKeysCommandUser nobody\nPubkeyAcceptedKeyTypes +ssh-rsa\nHostKeyAlgorithms +ssh-rsa" >> /etc/ssh/sshd_config
|
apt install wget
|
||||||
|
# Datei definieren
|
||||||
|
SSHD_CONFIG="/etc/ssh/sshd_config"
|
||||||
|
# Konfigurationszeilen definieren
|
||||||
|
CONFIG_LINES=(
|
||||||
|
"PubkeyAuthentication yes"
|
||||||
|
"PasswordAuthentication no"
|
||||||
|
"AuthorizedKeysCommand /usr/local/bin/userkeys.sh"
|
||||||
|
"AuthorizedKeysCommandUser nobody"
|
||||||
|
"PubkeyAcceptedKeyTypes +ssh-rsa"
|
||||||
|
"HostKeyAlgorithms +ssh-rsa"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Schleife über jede Zeile
|
||||||
|
for line in "${CONFIG_LINES[@]}"; do
|
||||||
|
# Überprüfen, ob die Zeile bereits in der Datei vorhanden ist
|
||||||
|
if ! grep -Fxq "$line" "$SSHD_CONFIG"; then
|
||||||
|
# Zeile anhängen, wenn sie noch nicht existiert
|
||||||
|
echo "$line" | sudo tee -a "$SSHD_CONFIG" > /dev/null
|
||||||
|
fi
|
||||||
|
done
|
||||||
wget -P /usr/local/bin https://raw.githubusercontent.com/Hobbabobba/keyserver/main/userkeys.sh
|
wget -P /usr/local/bin https://raw.githubusercontent.com/Hobbabobba/keyserver/main/userkeys.sh
|
||||||
chmod a+x /usr/local/bin/userkeys.sh
|
chmod a+x /usr/local/bin/userkeys.sh
|
||||||
service ssh restart
|
service ssh restart
|
||||||
echo "FERTIG"
|
echo "SSH Zugang fertig"
|
||||||
|
|||||||
Reference in New Issue
Block a user