# How to programmatically log out lots of users

**URL:** <https://meta.discourse.org/t/how-to-programmatically-log-out-lots-of-users/37611>\
**Category:** Product Support\
**Created:** [2016 年1 月 7 日 21:16 UTC](https://meta.discourse.org/t/how-to-programmatically-log-out-lots-of-users/37611 "2016-01-07T21:16:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![eriko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eriko/32/1915_2.png) [@eriko](https://meta.discourse.org/u/eriko)\
发布日期： [2016 年1 月 7 日 21:16 UTC](https://meta.discourse.org/t/how-to-programmatically-log-out-lots-of-users/37611/1 "2016-01-07T21:16:47Z")

</div>

So I need to end a bunch of people login sessions at once on a quarterly basis. I notice that admin/users.rb log\_out uses `MessageBus.publish "/logout", @user.id, user_ids: [@user.id]`. Can I use that inside a plugin to mass logout users? I have ‘log out strict’ set so it should hit all the sessions.

---

_[View the full topic](https://meta.discourse.org/t/how-to-programmatically-log-out-lots-of-users/37611)._
