[sudo-users] Sudo unmasks signals

Marco listaddr at gmail.com
Sat Jan 19 06:03:16 EST 2013

I'm trying to prevent users from interrupting a script run via sudo + ssh, ie

# prevent ctrl-c
trap '' INT
sudo -u someuser ssh somehost '/path/to/script.sh'
# restore ctrl-c
trap - INT

However, it looks as if it's not that simple, as apparently sudo
unblocks SIGINT, catches it and sends it to ssh, which thus terminates
if the user does ctrl-c.

(it works as expected if not run through sudo)

Is this expected behavior, and if so, is there a way to have sudo
respect the existing signal mask? I'm using 1.7.4p4-2, last stable
version on debian squeeze (and for the time being I probably cannot


More information about the sudo-users mailing list