In Linux, if some compilation programs use the original socket, the root permission is required to run the program, but the permission cannot be improved when the program is running. What should I do at this time? Next we will introduce how to run the program compilation with root permission in Linux without adding sudo or switching to # prompt.
In Linux, if some compilation programs use the original socket, the root permission is required to run the program, but the permission cannot be improved when the program is running. What should I do at this time? Next we will introduce how to run the program compilation with root permission in Linux without adding sudo or switching to # prompt.
The procedure is as follows:
1. Use the root permission to complete gcc;
2. chmod u + s executable files
In this case, you can run the command just like the ping Command provided by Linux, without the need for sudo or switching to the # prompt.
Of course, since the ping source code on UNP uses setuid (getuid () after the original socket is created, the minimum permission principle is maintained.
The above two steps are indispensable. As long as you follow the methods described in this article, you can run your own compiled programs with root permissions on Linux.