Untitled

 avatar
unknown
plain_text
a year ago
483 B
4
Indexable
#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);
}
Editor is loading...
Leave a Comment