Portál AbcLinuxu, 8. května 2025 02:31
- setgid(getgid()); - setuid(getuid()); + if (setgid(getgid())) + return 1; + if (setuid(getuid())) + return 1;
Hm, zajímavé. Můžete mi někdo vysvětlit, jak je možné zvnějšku ovlivnit, aby se root nemohl sám změnit na jiného uživatele?
/etc/passwd
nebo NIS.
[EPERM] The user is not the superuser and the requested uid or euid is not the process's real, effective, or saved UID.ale pak jsem se podival na Linuxovy manpage
EAGAIN The call would change the caller's real UID (i.e., uid does not match the caller's real UID), but there was a temporary failure allocating the necessary kernel data structures. EAGAIN uid does not match the real user ID of the caller and this call would bring the number of processes belonging to the real user ID uid over the caller's RLIMIT_NPROC resource limit. Since Linux 3.1, this error case no longer occurs (but robust applications should check for this error); see the description of EAGAIN in execve(2). EINVAL The user ID specified in uid is not valid in this user namespace. EPERM The user is not privileged (Linux: does not have the CAP_SETUID capability) and uid does not match the real UID or saved set-user-ID of the calling process.a asi by nejak slo zpusobit "temporary failure allocating the necessary kernel data structures".
setuid()
a změnit mapování UID pro příslušný user namespace mezi voláním getuid()
a setuid()
.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.