How does Linux know that it has to give euid 0 (uid of root) to only certain process like passwd, setuid, etc.
If a process can gain root permissions, will it not lead to potential security breaches in the Linux platform?
For example, if I write a program that can can gain root user permissions like passwd, I may corrupt important system files like /etc/passwd, /etc/groups.
How does Linux manage to still be secure?