cybersecurity · intermediate · ~15 min · safe pentest lab

Is the setuid bit set?

Test a permission bit with a mask.

Challenge

The setuid bit is octal 04000 in a Unix mode. Implement int is_setuid(int mode) returning 1 if that bit is set, else 0.

Starter code

int is_setuid(int mode) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.