Logging out user after remote screen sharing

clyde
New Contributor III

for some reason sometimes, when I connect to a computer via jamf Remote - it loads screen sharing, and I decide not to share screen, but to log in using another account. - Install update, remove files etc whatnot.

then I log out - but end user cannot restart computer, as the admin account is still logged in

whats the best way to log out the admin user remotely, using Execute command ?

2 REPLIES 2

benjamin_lesko
New Contributor

Has there ever been a solution discovered to this issue?

mm2270
Legendary Contributor III

I don't know that I've ever run into this issue, but I imagine you could run a command to get the loginwindow PID for the user you had logged into and might still be active, and then use that in a kill command to shut down their session. Something like the following, but replacing <username> with the actual user account name.

PID=$(ps axuc | awk '/<username>/ && /loginwindow/{print $2}'); /bin/kill -9 $PID

I would test that out thoroughly before using it on production machines to be sure there are no adverse effects. It's never a great idea to kill the loginwindow of a user session, but I suppose sometimes it's just necessary.