I created a binary file with Go Language. The owner of the file will be "userA" and the execution permission is set as "userA". The above configurations is enabled using the following commands
sudo chown userA:userA ./program
sudo chmod a+s ./program
Is it possible to change the ownership of the program to userB and execution permission to userB inside the program binary file.
./program change-permission
This command should change the ownership of the running program to userB and execution permission to userB inside the program binary file.
I tried the above commands as a shell script and tried change the ownership and execution permission of the same shell script and it didn't work as expected.
Kindly can anyone advise on this and provide some sample command or code?