# SUID or SGID

**SUID**: es un bit que se asigna a los ficheros. Permite que cualquier usuario que ejecute el programa lo haga con los mismos permisos que el creador de dicho fichero

**SGID**: igual que SUID pero se ejecuta con los permisos del grupo al que pertenece el creador. Podemos hacer una búsqueda de estos ficheros

Usando `find` de la siguiente manera:

`find / -type f -perm -4000 2>/dev/null` # Muestra los ficheros con permisos SUID

`find / -perm -4000 -user root 2>/dev/null` # Para users especificos

`find / -type f -perm -2000` # Muestra los ficheros con permisos SGID

`find / -type -f -user root -perm -u=s 2>/dev/null` # Otra manera de mostrar los ficheros con permisos SUID

`find / -perm +6000 2>/dev/null` # muestra los ficheros con bits SUID y SGID activos


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eldeim.gitbook.io/brain_fuck/notes/linux-hardening/privilege-escalation-linux/suid-or-sgid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
