Force
Force

Reputation: 6382

Execute a script as root from Asterisk

I have the following extension.conf:

exten => XXX,Answer()
exten => XXX,n,Playback(/var/lib/asterisk/sounds/delExtHDD)
exten => XXX,n,System(/bin/sh /etc/asterisk/deletekeys.sh)
exten => XXX,n,Hangup()

The scripts chmod is 4755 and owned by root.

The script itself contains the following:

#/bin/sh
#/usr/bin/wipe -f -q /XXX
/bin/umount /media/sda/
/sbin/cryptsetup luksClose sda_crypt

Apparently the script is executed, but it doesn't unmount the filesystem, therefore I suggest it has no root rights.

How can I execute the script as root?

Upvotes: 0

Views: 2175

Answers (1)

Force
Force

Reputation: 6382

Thanks to Mat for the hint to the unix stackexchange!

I compiled a C programm which can be found at https://unix.stackexchange.com/a/369/16009 that executes the script as root.

Upvotes: 1

Related Questions