meta data de esta página
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
seguridad:usuarios [2015/04/20 13:41] – luisca | seguridad:usuarios [2023/01/18 14:11] (actual) – editor externo 127.0.0.1 | ||
---|---|---|---|
Línea 5: | Línea 5: | ||
< | < | ||
+ | |||
+ | También para entornos con LDAP podemos usar | ||
+ | < | ||
+ | |||
También podemos ejecutar el siguiente script para ver cuales son usuarios creados por el sistema | También podemos ejecutar el siguiente script para ver cuales son usuarios creados por el sistema | ||
Línea 33: | Línea 37: | ||
echo " | echo " | ||
awk -F':' | awk -F':' | ||
+ | </ | ||
+ | |||
+ | Listado tipo tabla | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # Name: listusers.bash | ||
+ | # Purpose: List all normal user and system accounts in the system. Tested on RHEL / Debian Linux | ||
+ | # Author: Vivek Gite , under GPL v2.0+ | ||
+ | # http:// | ||
+ | # ———————————————————————————– | ||
+ | _l=”/ | ||
+ | _p=”/ | ||
+ | |||
+ | ## get mini UID limit ## | ||
+ | l=$(grep “^UID_MIN” $_l) | ||
+ | |||
+ | ## get max UID limit ## | ||
+ | l1=$(grep “^UID_MAX” $_l) | ||
+ | |||
+ | ## use awk to print if UID >= $MIN and UID = min && $3 = min && $3 <= max && $7 != "/ | ||
+ | |||
+ | echo " " | ||
+ | |||
+ | ## use awk to print if UID $MAX ## | ||
+ | echo “—————————-[ System User Accounts ]—————————” | ||
+ | printf “%-15s %-5s %-5s %-25s %-10sn” “Login” “UID” “GID” “Home” “Shell” | ||
+ | echo “——————————————————————————-” | ||
+ | awk -F': | ||
+ | </ | ||
+ | |||
+ | |||
+ | Listado de grupos | ||
+ | |||
+ | <code bash> | ||
+ | # | ||
+ | # Name: listgroups.bash | ||
+ | # Purpose: List all normal user and system groups in the system. Tested on RHEL / Debian Linux | ||
+ | # Author: Vivek Gite , under GPL v2.0+ | ||
+ | # http:// | ||
+ | # ———————————————————————————– | ||
+ | _l=”/ | ||
+ | _g=”/ | ||
+ | |||
+ | ## get mini GID limit ## | ||
+ | l=$(grep “^GID_MIN” $_l) | ||
+ | |||
+ | ## get max GID limit ## | ||
+ | l1=$(grep “^GID_MAX” $_l) | ||
+ | |||
+ | ## use awk to print if GID >= $MIN and GID = min && $3 = min && $3 <= max ) printf "%-15s %-5s %-10sn", | ||
+ | |||
+ | echo " " | ||
+ | |||
+ | ## use awk to print if GID $MAX ## | ||
+ | echo “—————————–[ System User Groups ]—————————-” | ||
+ | printf “%-15s %-5s %-10sn” “Group” “GID” “Logins” | ||
+ | echo “——————————————————————————-” | ||
+ | awk -F': | ||
+ | |||
</ | </ | ||