i think i figured it out... i need the *parent* pid, not the pid itself. https://raamdev.com/2007/kill-inactive-and-idle-linux-users/
This commit is contained in:
parent
c55b844ad1
commit
31e8c4acee
@ -106,7 +106,7 @@ for user in psutil.users():
|
||||
'timeout': timeout}
|
||||
fmtd_goodbye = goodbye_mesg.format(**fmt_vals)
|
||||
if only_ssh:
|
||||
if user.pid in ssh_pids:
|
||||
if psutil.Process(user.pid).ppid() in ssh_pids:
|
||||
if goodbye:
|
||||
subprocess.run(['write',
|
||||
user.name,
|
||||
|
Loading…
Reference in New Issue
Block a user