bash: Test if file(s) has setuid bit set.
-
Take into account the main readme for this section. README first.
Using the test option
-u
you can test a file for setuid bit set.FILE=/usr/bin/passwd if [[ -u "$FILE" ]];then echo "$FILE is a setuid file." fi
The script execution output of the script is: A file that is know to have setuid set was chosen to demonstrate the test option.
$ ./test.sh /usr/bin/passwd is a setuid file.
© Lightnetics 2024