very simple, but it works: you can easily write a small c-program that does what you want in this example, the UID of the file or directory or link is retrieved, just try to find the properties you need.
compile with:
gcc -xc my-prog.c -o my-prog
then
./my-prog /etc
you can get a lot of other information, for example,
he is not stable. but whatever I know, I know how to use it, and do a check in the bash shell :-)
[ -x /etc ] && my-prog /etc
source:
# retrieve the uid of a file # source code: my-prog.c # #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> int main(int argc, char **argv) { struct stat buffer; int status; char *fname; fname=argv[1]; status = stat(fname, &buffer); printf("%i",buffer.st_uid); return 0; }
source share