[sudo-users] SIGHUP signal with sudoedit
R. Diez
rdiezmail-temp2 at yahoo.de
Sat Jul 7 09:06:57 MDT 2018
Hi there:
I am trying to write a Bash script that uses sudo and sudoedit and I am
getting signal SIGHUP from sudoedit. But let's start without a script,
just running sudoedit manually. On Xubuntu 16.04.4, this is what I am
getting:
----- Begin -----
$ sudoedit "$HOME/somefile.txt"; echo "sudoedit exit code: $?"
sudoedit: /home/rdiez/somefile.txt: editing files in a writable
directory is not permitted
Hangup
sudoedit exit code: 129
$ bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
$ sudo --version
Sudo version 1.8.16
Sudoers policy plugin version 1.8.16
Sudoers file grammar version 45
Sudoers I/O plugin version 1.8.16
----- End -----
On Ubuntu MATE 18.04, I get this instead:
----- Begin -----
$ sudoedit "$HOME/somefile.txt"; echo "sudoedit exit code: $?"
sudoedit: /home/rdiez/somefile.txt: editing files in a writable
directory is not permitted
sudoedit exit code: 1
$ bash -version
GNU bash, version 4.4.19(1)-release (i686-pc-linux-gnu)
$ sudo --version
Sudo version 1.8.21p2
Sudoers policy plugin version 1.8.21p2
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.21p2
----- End -----
I would like to understand where the SIGHUP signal is coming from on
Xubuntu 16.04.4, and who is actually printing the signal message. I
actually noticed the first time around when the script called sudoedit
and I did not modify the file. That signal comes then after the
following message:
sudoedit:
/var/lib/polkit-1/localauthority/10-vendor.d/49-my_personal_nopasswd_global.pkla
unchanged
If I do modify the file after sudoedit opens up an editor, everything is
OK, and the signal is not coming anymore.
It is all very strange. If I call sudoedit from within the script, I get
something like this (the system is localized to Spain):
./nopass-polkit.sh: línea 109: 4466 Colgar (hangup) sudoedit
/var/lib/polkit-1/localauthority/10-vendor.d/49-my_personal_nopasswd_global.pkla
If I trap the signal within the Bash script, the trap code does not run
(?), but the signal message gets shortened to "Colgar (hangup)". That is
like when running sudoedit manually without a script.
I looked at .bashrc, unset EDITOR and SUDO_EDITOR, but the signal is
still coming. Nothing else is trapping SIGHUP anywhere. I even started
the Dash shell instead, and the behaviour is the same.
Can anybody help?
Thanks in advance,
rdiez
More information about the sudo-users
mailing list