# How to delete a ghost bot user with admin privileges?

**URL:** https://meta.discourse.org/t/topic/410144
**Category:** Support
**Created:** [August 16, 2026, 5:14am UTC](https://meta.discourse.org/t/topic/410144 "2026-08-16T05:14:25Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [August 16, 2026, 12:16pm UTC](https://meta.discourse.org/t/topic/410144/10 "2026-08-16T12:16:58Z")

</div>

Beware that using the Rails console is an extraordinary action, and if you remove the wrong AI bot, you can break some functionality. Check this:

> [@Deleting Users in rails console](https://meta.discourse.org/t/deleting-users-in-rails-console/141540/):
>
> We are using SSO to log in users that autenticated on our main website One of our users got a message (on login) that there was an error and that she should contact an administrator. So we searched for her but could not find her profile. I did the first best thing i could imagine and “deleted” her via command line User.find\_by(email: "ex@example.com").delete which was not smart and did not really work. When she tried to login she was faced with the same error. Now her profile exist (not fin…

I think you can also remove admin privileges before deleting users from the GUI.

1. Entering into the Rails console (you want to backup just in case):

```plaintext
cd /var/discourse/
./launcher enter app
rails c

```

1. Removing the privileges:

```plaintext
u = User.find_by(username: "BOT_USERNAME")
u.revoke_admin!

```

---

_[View the full topic](https://meta.discourse.org/t/topic/410144)._
