The usr.sbin/adduser/rmuser.sh script which ends up in /usr/sbin/rmuser when ran from a host system such as `rmuser user` will kill all processes owned by `user` in its kill_procs routine by identifying processes with `ps -U $USER`.
This includes jailed processes which is not something to be expected (or is it?).
I could submit a patch which would remove processes which have a J flag hidden behind an argument such as --no-jail / -F but don't know if this is desirable.
It doesn't seem there are much better options here as we can't get the current JID as far as I'm aware. If that were possible we could add the -J $JID flag to ps.
- create user user1 on host system
- create jail1 with user1
- run process in jail1 as user1
- rmuser user1 on host system
- process running in jail1 gets killed
- jailed processes are not the same user as the host system and should not be killed