I'm using the following program, and I've suid-ed it (by running chown root XXX; chmod 4755 XXX
as root), but the output is still ruid 1000, euid 1000, suid 1000
, shouldn't effect uid be zero here?
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
int main()
{
uid_t ruid, euid, suid;
if (! getresuid (&ruid, &euid, &suid))
printf ("ruid %d, euid %d, suid %d\n", ruid, euid, suid);
else
perror ("getresuid");
return 0;
}
Output of ls -l:
-rwsr-xr-x 1 root root 9.7K May 1 11:36 test*
Please check the mount
command output, your file system could be mounted with nosuid
option.
From mount man page
nosuid: Do not allow set-user-identifier or set-group-identifier bits to take effect.