Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
483 B
1
Indexable
Never
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[]) {
    if (argc != 2) {
        fprintf(stderr, "Usage: %s <executable>\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    // Setăm bitul set-user-ID folosind chmod
    if (chmod(argv[1], S_ISUID | S_IXUSR | S_IRUSR) < 0) {
        perror("chmod error");
        exit(EXIT_FAILURE);
    }

    printf("Set-user-ID bit set for %s\n", argv[1]);
    exit(EXIT_SUCCESS);
}
Leave a Comment