I am trying to execute the C++ compiled program as root, while I am another user.
Program is successfully executed, but as a regular user, not the root.
However, as the internet says, chmod u+s
command makes it run as the owner (in my case - root).
Program is a simple system(argv[1])
line, which will execute everything inside the command line argument.
For example - Output for whoami
returns my user, not the root.
Also trying to list contents of /root
ends up in "Permission denied".
Permissions of the file -
-rwsr-xr-x 1 root root 16608 Aug 25 15:20 test
At this moment I tried to make permissions of the file 4755
(no luck there).
Moving file in /root
was also not lucky.