I have the following script:
$ ls -al setprog.sh
-rwsrwxr-x 1 root root 52 Αυγ 2 10:23 setprog.sh
$ cat setprog.sh
#!/bin/bash
while [ True ]
do
echo $(whoami)
done
When running it
$ ./setprog.sh
pkaramol
pkaramol
pkaramol
Why the process owner indicated by ps
(real user) and and the user by whom the program is executed (effective user?) match? Shouldn't the one of them be root
given that the script is owned by him?
$ ps aux | grep -i setpr
pkaramol 10294 18.0 0.0 12888 3268 pts/0 S+ 10:45 0:00 /bin/bash ./setprog.sh
pkaramol 16746 0.0 0.0 14432 1104 pts/1 S+ 10:45 0:00 grep --color=auto -i setpr
echo $(whoami)
instead of justwhoami
? Why test on the stringTrue
and notwhile true
? – Kusalananda Aug 02 '18 at 07:53whoami
instead of$(whoami)
it will stdout the stringwhoami
instead of the result of the commandwhoami
;True
vstrue
does not make much of a difference; – pkaramol Aug 02 '18 at 07:55setuid
bit is gone; – pkaramol Aug 02 '18 at 07:56