#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pwd.h>

int main(int argc, char *argv[]) {
    struct passwd *pw = getpwuid(getuid());
    if (!pw || strcmp(pw->pw_name, "alex") != 0) {
        printf("Access denied.\n");
        return 1;
    }

    if (argc != 2) {
        printf("Usage: %s <path>\n", argv[0]);
        return 1;
    }

    if (setgid(0) != 0 || setuid(0) != 0) {
        perror("setuid");
        return 1;
    }

    char cmd[256];
    snprintf(cmd, sizeof(cmd), "ls -la /%s", argv[1]);
    execl("/bin/bash", "bash", "-p", "-c", cmd, (char *)NULL);
    perror("exec");
    return 1;

    return 0;
}
