Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I think that this is a security lock-down problem but wondered if anyone could confirm. I have a shell script that calls another shell script via sudo which in turn calls yet another shell script. So the basic architecture is:

master.sh calls sudo on cmd1.sh which calls on cmd2.sh

master.sh looks basically like this:

sudo -u monkey -b ./cmd1.sh
echo "myPGID: $myPGID myPPID:$myPPID" > out.txt

cmd1.sh looks like this:


cmd2.sh looks like this:

sleep 1000

When I execute master.sh on Red-Hat Linux box #1 and the perform ps -ejH followed by more out.txt I get the results I expect, namely this, basically:

[root@booger]# ./master .sh
[root@booger]# ps -ejH
4534   4532   4424  pts/2  00:00:00 cmd1.sh
4535   4532   4424  pts/2  00:00:00    cmd2.sh
4536   4532   4424  pts/2  00:00:00       sleep
[root@booger]# more out.txt
myPGID: 4532 myPPID:4453

However, when I run the same test on Red-Hat box #2 (which has security lock-downs) I cannot get the proper group ID (which my production script saves off as a means to shut down the process tree at a later time). Here is the sequence seen on this second machine:

[root@production]# ./master.sh
[root@production]# ps -ejH
2473   2473   1470  pts/0   00:00:00 sudo
2474   2473   1470  pts/0   00:00:00   cmd1.sh
2475   2473   1470  pts/0   00:00:00      cmd2.sh
2476   2473   1470  pts/0   00:00:00        sleep
[root#production]# more out.txt
myPGID:2471 myPPID:1490

So I can't seem to figure out a way to get either the PGID or the main PPID returned to the master shell on the second box. Any idea anyone ?

share|improve this question
SOLVED- Has to do with the version of sudo between the two boxes, NOT security lock downs. To fix, remove the "-b" switch on the sudo command and place "&" at the end of the command. –  Mescg Roupe Aug 21 '13 at 16:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.