I've used bash for years but I 've stuck with the"privileged mode" that it can be configure with the set command.
For example:
set -p
I've read the bash man page but it's somewhat obscure.
For example let's considere the following script
#! /bin/bash -p
ping 192.168.1.1
the permission of this file is as follows:
-rwxr-xr-x. 1 root operador 80 mar 2 23:20 /scripts/privileged.sh
And then as a non-root user I run /scripts/privileged.sh
So I run:
ps -Cping -ocomm,egroup,euser,ruser,ruser,rgroup
COMMAND EGROUP EUSER RUSER RUSER RGROUP
ping operador operador operador operador operador
OK, you can change the mode, but anyway Linux drops privileges:
[root@server ~]# chmod 4755 /scripts/privileged.sh
[root@server ~]# ls -l /scripts/privileged.sh
-rwsr-xr-x. 1 root operador 79 mar 2 23:33 /scripts/privileged.sh
So I run the script as non-root user, and then I get:
[root@server ~]# ps -Cping -ocomm,egroup,euser,ruser,ruser,rgroup
COMMAND EGROUP EUSER RUSER RUSER RGROUP
ping operador operador operador operador operador
So I've found this option useless, please could you correct me, if I misunderstood anything?