[sudo-users] SIGHUP not reaching child process when closing the terminal window

R. Diez rdiezmail-temp2 at yahoo.de
Thu Apr 7 13:37:46 MDT 2022

Hi all:

I am using this script to connect to an OpenVPN server:


Essentially, the script runs "sudo openvpn".

If I press Ctrl+C on the terminal window, the connection is teared down correctly. The 'openvpn' server process seems to get SIGINT somehow.

However, if I close the terminal window with the mouse, the 'openvpn' server process stays running invisibly in the background.

How do I approach this problem?

I have seen some advice on the Internet about how sudo forwards such signals, but I did not unterstand any of it.

The funny thing is that I believe that SIGHUP has worked in the past on this same system.

The connect-with-openvpn.sh script does have a "trap EXIT" that runs upon reception of any signal (like SIGINT or SIGHUP).

I experimented with manually sending SIGHUP from another terminal, but the normal user account has no permission to send SIGHUP to the 'sudo' or the 'openvpn' processes, probably because they are running under a different user account.

The 3 processes (connect-with-openvpn.sh, 'sudo' and 'openvpn') actually run on the same process group, but signalling the whole process group does not work either, probably because of the different user accounts again.

I am using sudo version 1.8.31 that comes with Ubuntu 20.04.4.


More information about the sudo-users mailing list