Untitled

 avatar
unknown
plain_text
23 days ago
518 B
7
Indexable
#!/bin/bash

# Vérifier le nombre de connexions SSH pour root (y compris locales)
root_co=$(ps -ef | grep -E "sshd: root@" | grep -v grep | grep -E "sshd: root@|sshd: root[[:space:]]*\(" | wc -l)

# Condition pour afficher l'état en fonction du nombre de connexions
if [ "$root_co" -eq 0 ]; then
    echo "OK - Aucune connexion SSH pour root."
elif [ "$root_co" -eq 1 ]; then
    echo "Warning - Une connexion SSH pour root."
else
    echo "Critical - Nombre de connexions SSH pour root : $root_co."
fi
Editor is loading...
Leave a Comment