You are not logged in.

#1 2019-07-18 03:38:32

mrjcsh
Member
Registered: 2019-07-18
Posts: 7

Sub-shell sudo -iu $user followed by exit initiates a reboot.

While unit testing, to hopefully use sudo privs for certain actions, but use wget with a non-sudo user for file retrieval. I had initiated the following script in hopes of finding the desired affect. Bash -x got as far as sudo -iu, and then promptly reboots itself almost seemingly skipping a majority of typical shutdown tasks, as the bios screen shows up as abruptly as the shutdown process. Part of the reason why I'm not posting log entries, or even trying. I am, partly also, uncertain of which log to look in for what could be some form of erroneous permission noise.
  Make note that the following script was initiated x3 times using 'sudo bash -x unit-test' and had precisely the same outcome each iteration.

Conditions:

  $ uname -a
  ... 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 ...

  $ bash --version
  ... 4.4.12(1)-release

  $ sudo --version
  ... 1.8.19p1

  $ /usr/bin/x-terminal-emulator --version
  terminator 1.90

  $ cat -n unit-test
       1  #!/bin/bash --
       2 
       3  touch ./$USER.v1
       4  sudo -iu mrjcsh && \
       5    touch ./$USER.v2
       6  exit # breaks subshell
       7  touch ./$USER.v3
       8  exit 0

Last edited by mrjcsh (2019-07-18 03:47:10)

Offline

#2 2019-07-18 05:23:25

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: Sub-shell sudo -iu $user followed by exit initiates a reboot.

Weird.
Not sure.
What happens if you ‘set +x’ just before the sudo -iu line, to see if it the debug mode that causes it.

Offline

#3 2019-07-18 07:06:20

mrjcsh
Member
Registered: 2019-07-18
Posts: 7

Re: Sub-shell sudo -iu $user followed by exit initiates a reboot.

as expected, the output cuts out right at 'set +x'. I have found that sudo -u doesn't kill off the system. Though, the question still remains, why does it hardware level reboot like that? I haven't connected the os to the internet yet, as I'm going through the usual cis compliance hoops and script generation for re-application. So, bare in mind, I only have the as of a week ago installed experience to work with.

Offline

#4 2019-08-04 17:30:51

ohnonot
...again
Registered: 2015-09-29
Posts: 4,165
Website

Re: Sub-shell sudo -iu $user followed by exit initiates a reboot.

a bit late now, but...

mrjcsh wrote:

I am, partly also, uncertain of which log to look in for what could be some form of erroneous permission noise.

you should look in systemd's journal via

journalctl -b

I'm sure there's something in it that pertains to your problem.
You just might need to enable persistent journals first, then reproduce the problem.

Offline

Board footer

Powered by FluxBB