Revoke active GitLab sessions for all users

by Prapattimynk, Sunday, 17 September 2023 (5 months ago)
Revoke active GitLab sessions for all users


If you have a self-hosted version of GitLab, you may need to revoke all active sessions for all users (for example, to force a password change when using an external authenticator like LDAP or OAuth2).

There isn’t a GUI action to do so, so we need to open the rails console gitlab-rails console -e production and issue a simple ruby command:

User.find_each do |user|
  ActiveSession.list(user).each do |session|
    ActiveSession.destroy_session(user, session.session_private_id)
  end
end

Comments

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

AdBlocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.