I was using a computer somewhere to login my site as admin, but forgot to logout. How can I logout my account from another computer?


I think you can just remove the relevant entries from the sessions table:

db_delete('sessions')->condition('uid', $your_user_id)->execute();

That should log the user out everywhere.

| improve this answer | |
  • Thank You Clive. Can I use the phpmyadmin and delete all my "uid" rows under "sessions" section? – CocoSkin Apr 16 '14 at 18:42
  • Just did that and work like a charm :) – CocoSkin Apr 16 '14 at 19:13

I wrote up a small drush command to do this:

$ drush help session-delete
Delete user sessions from the database.
 drush session-delete all                  Delete all sessions.
 drush session-delete 64                   Delete sessions for user id 64.
Aliases: sess-del

Technically, this just deletes the session and doesn't do a proper logout. Those are nearly identical, though, under most circumstances.

This patch hasn't been committed, so you would need to download drush extras and apply it, or just extract the file from the patch and add it to your local commands.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.