setuid permissions in Linux
setuid stands for Set User ID on Execution. What is User ID(UID)? UID is a number used to uniquely identify the user on the system, and to determine which system resources the user can access. When you create a file, the ownership of the file will be based on the user id and group id of the user created the file. When you run a process, the process will be running with the user id and group id of the user starting the process . It means, if user1 created an executable file, the owner and group of file will be the user1, but when we run the executable with other user, the uid of the process will be the other user not the user created the executable. getuid() returns the User Id of the calling process. In the above screenshot, I created hello.c with the user 'jamal', so the owner and group is 'jamal'. But when running the generated executable/process we get the uid of the user who started the executable/process. If you set the setuid bit on the executa...