linux-setuid-files

Retrieves a list of files owned by root with the SETUID bit set on a Linux system. Because files with SETUID set run with the file owner's privileges, this command is used during security audits to check for unauthorized SETUID files.

Command properties

ItemDescription
Command typeDriver query
Required permissionAdministrator
License usageLicensed command
Parallel executionNot supported
Distributed executionRuns on Data Node (mapper)

Syntax

linux-setuid-files [md5=BOOL]

Options

md5=BOOL
Whether to calculate the MD5 hash of each file and assign it to the md5 field. (Default: f)

Output fields

FieldTypeDescription
file_pathstringAbsolute path of the file
file_namestringFile name
file_typestringFile type. file or directory
permissionsstringFile permission string (e.g., rws------). The SETUID bit is displayed as s.
file_sizelongFile size (bytes)
file_ctimetimestampFile creation time
file_mtimetimestampLast modification time
file_atimetimestampLast access time
md5stringMD5 hash of the file. Only output when the md5=t option is specified.
owner_readbooleanWhether the owner has read permission
owner_writebooleanWhether the owner has write permission
owner_executebooleanWhether the owner has execute permission
group_readbooleanWhether the group has read permission
group_writebooleanWhether the group has write permission
group_executebooleanWhether the group has execute permission
others_readbooleanWhether others have read permission
others_writebooleanWhether others have write permission
others_executebooleanWhether others have execute permission

Error codes

Parse errors
Error codeMessageDescription
95040no-read-permissionOccurs when run without administrator privilege
Runtime errors

N/A

Description

The linux-setuid-files command runs find / -user root -perm -4000 -print to search for files owned by root with the SETUID bit set. It collects metadata for each found file and assigns the file path, size, timestamps, and permission information to output fields.

The permissions field displays s in the owner execute position to indicate that the SETUID bit is set. For example, a SETUID file with rwxr-xr-x permissions is displayed as rwsr-xr-x.

When the md5=t option is specified, the MD5 hash of each file is calculated. Execution time may be longer when there are many files or the files are large.

Examples

  1. Retrieve a list of SETUID files

    linux-setuid-files
    

    Retrieves a list of all SETUID files on the system.

  2. Retrieve SETUID files including MD5 hash

    linux-setuid-files md5=t
    

    Retrieves the MD5 hash of each SETUID file along with its metadata. This can be used for file integrity verification.

  3. Filter SETUID files in a specific directory

    linux-setuid-files
    | search file_path == "/usr/bin/*"
    

    Filters only SETUID files in the /usr/bin directory.