How to Lock Roles, Channels, and the Whole Server in Discord
Locking in Discord means three things. Locking a channel removes Send Messages for a role there. Locking a role stops people from editing or assigning it, using role hierarchy and Manage Roles. Locking down the server removes Send Messages everywhere at once. Security Bot does it with /lockall. Its anti-raid (Premium) locks channels you choose automatically during a raid.
Lock a channel for a role
A locked channel is one where a role can see messages but cannot send them. This is a permission override, not a special mode.
- Open the channel, click the gear, and go to Permissions.
- Select the role you want to lock out, usually @everyone.
- Set Send Messages to the red X (deny). Do the same for Send Messages in Threads and Add Reactions if you want a full lock.
- Leave View Channel allowed so members can still read.
- To reopen, set Send Messages back to neutral (the slash) or allow.
With Security Bot, /lock denies Send Messages to @everyone in the current channel in one step. /lock channel:#general time:10m locks a chosen channel for ten minutes, then reopens it automatically and puts Send Messages back the way it was. /unlock does the same straight away. Both are written to the moderation log.
Roles that have Send Messages allowed on the channel override the @everyone deny. If a locked channel still accepts messages from some members, one of their roles has an explicit allow on it, or they have Administrator.
Lock a role so nobody can edit or assign it
Discord has no lock button on roles. What people mean is preventing staff from changing a role's permissions, renaming it, or giving it to someone. The tools are hierarchy, the Manage Roles permission, and an anti-nuke bot.
- Hierarchy. A user can only edit or assign roles below their own highest role. Put sensitive roles (Admin, Moderator, bot roles) above everyone who should not touch them.
- Manage Roles. Only members with this permission can edit roles at all, and only grant permissions they already have themselves. Remove it from everyone except the owner and one trusted admin.
- Anti-nuke triggers. Security Bot's Anti Role Permission Change trigger fires when someone edits the permissions of a role that carries moderation or management permissions. It strips those permissions from the role and punishes the editor.
- Anti Admin Role Assign removes such a role from the member it was given to and punishes whoever handed it out. Both triggers are free and instant, but off by default, so turn them on on the Anti-Nuke page.
- Anti Role Rename (Premium) punishes anyone who renames a role, which is a common part of a defacement.
Together these make a role effectively locked: nobody below it can change it, almost nobody has Manage Roles, and a dangerous permission edit or admin-role grant is reverted and punished on the first attempt.
Lock down the whole server
A server lockdown stops members from posting in every channel. Use it during a raid, a leak, or a compromised-account incident to buy time while you clean up.
Manually
- Open Server Settings, Roles, @everyone.
- Turn off Send Messages and Send Messages in Threads in the role's permissions. This affects every channel without an explicit allow override. But any other role whose own permissions include Send Messages keeps posting, so check your member roles too.
- Check channels with role-specific allows and lock those individually.
- Pause invites so no new accounts join during the incident. Server Settings, Invites, Pause Invites (needs Manage Server) stays paused until you turn it back on. Security Actions in the server name menu pauses them for up to 24 hours.
- Reverse the changes when the incident is over.
This works but is slow under pressure and easy to get wrong when many channels have overrides.
With Security Bot
Grant lockall to two moderators
On the Moderation page of the Security Bot dashboard give at least two staff the LockAll and UnlockAll command permissions. They do not need Manage Channels.
Keep a staff channel usable
/lockalldenies Send Messages to @everyone in every regular text channel the bot can manage. Give your staff role an explicit Send Messages allow on the staff channel so the team can still talk during a lock.Lock the server
Run the command from any channel. Add a time such as
30mif you want the channels to reopen on their own.Command:
/lockall reason:Raid time:30mPost a short notice
In the announcements channel tell members the server is temporarily locked and will reopen shortly.
Unlock when it is over
Reverse the lock in one command, or let the time you set run out. Either way, only the channels Security Bot locked reopen. Each gets back the Send Messages setting it had before the lock, so read-only channels stay read-only. Individual channels can also be reopened with /unlock.
Command:
/unlockall
/lockall covers every regular text channel the bot can manage, not a list you configure. Announcement and forum channels and the chat in voice channels are not touched. Channels where @everyone already cannot send messages are left as they are, and they stay read-only after /unlockall. If you only want to close a few channels, use /lock on each one instead.
Automatic lockdown during a raid
With anti-raid enabled on Premium, Security Bot locks the channels you pick in the Lockdown section of the Anti-Raid page when the join score reaches your limit. It reopens them after the lock duration you set (20 minutes by default, anywhere from 2 minutes to 3 days). Nobody needs to be online.
The lock is written to the security log as an Anti Raid Lock event. Each locked channel gets a Channel Lock entry in the moderation log, with Security Bot as the moderator and the reason Anti Raid. The owner gets a short DM. This channel list applies only to automatic raid locks, and /lockall ignores it.
What to do during an active incident
- Lock first. Run
/lockall. Every regular text channel the bot can manage stops accepting messages from @everyone, and the locks are written to the moderation log. - Pause invites in Server Settings, Invites, or through Security Actions in the server name menu, so new accounts cannot join mid-incident.
- Find the source. The security log shows anti-nuke warnings and punishments and any anti-raid lock. Discord's audit log shows who deleted or created what.
- Remove the source. Strip a compromised account's roles or ban it. If a bot is responsible, kick the bot from Integrations.
- Clean up. Use
/clearin flooded channels and/softbanfor members whose accounts posted scam links, so their recent messages disappear from every channel at once. - Unlock. Run
/unlockall. It reopens only the channels Security Bot locked and leaves read-only channels as they were. Post a short all-clear and resume invites. If anything was deleted, follow how to recover after a nuke.
Common lockdown mistakes
- Denying @everyone and forgetting role allows. Any role with Send Messages explicitly allowed on a channel keeps posting. Check the channel's permission list for green ticks before you trust the lock.
- Locking the staff channel too.
/lockallreaches every text channel, so a staff channel that relies on @everyone's permissions goes quiet. Give the staff role an explicit Send Messages allow there before you need it. - Leaving invites open. A lockdown stops posting, not joining. Pause invites so the raid cannot keep growing while you clean up.
- Only one person can unlock. If the single moderator with LockAll goes offline, the server stays locked. Grant LockAll and UnlockAll to at least two people.
- Forgetting the lock. A lock without a time stays until someone reverses it. Use a timed lock such as
/lock channel:#general time:10mfor single channels or/lockall time:30mfor the whole server. - Running /unlock on a channel the bot did not lock. On a channel Security Bot locked,
/unlockputs Send Messages back the way it was. On any other channel it allows Send Messages for @everyone, which opens a rules or announcements channel that was meant to be read-only. After an incident, use/unlockallor let the timed lock run out. Both reopen only what the bot locked. - Locking instead of fixing the cause. A lock buys time. If the cause was a compromised account, strip its roles. If it was a join wave, let anti-raid punish the accounts. If it was a flood, let anti-spam clear it.
Choosing the anti-raid lock list
The automatic raid lock only touches the channels you select, so pick them on purpose. Include the public chat channels a raid would flood. Leave out the staff channel, so the team can coordinate, and any read-only announcements channel, which has nothing to lock.
The verification channel can stay off the list too. In Web check and One-click mode the Unverified role cannot post there. In Captcha code and Adaptive mode Security Bot deletes what is posted there. The anti-raid guide covers the scoring side.
How locks fit with verification and anti-spam
A lock is a Send Messages deny, so it only matters for members who could post. Verification works one layer earlier: unverified members are denied View Channel everywhere except the verification channel, so they never reach the locked channels to begin with. Keep both on. A lock stops existing members and compromised accounts. Verification slows new ones.
Anti-spam on Premium has its own smaller lock. It counts every message posted in a channel inside your time window. When the count reaches your limit, it can delete those messages and lock that single channel. The lock lasts for the lock duration you set. At the default of 0, it stays locked until someone runs /unlock. It never locks the whole server. That is anti-raid's job.
/lock, /unlock, /lockall, and /unlockall are written to the moderation log with the moderator, reason, and duration. An anti-raid lock appears in the security log as Anti Raid Lock, and each channel it locks also appears in the moderation log with Security Bot as the moderator. An anti-spam lock is not logged. The bot posts a notice in the locked channel instead.
Which lock to use
| Situation | What to lock | How |
|---|---|---|
| Off-topic flood in one channel | That channel | /lock or a Send Messages deny |
| Announcements should be read-only | That channel, permanently | Deny Send Messages for @everyone |
| Staff keep editing the Moderator role | The role | Hierarchy + remove Manage Roles + anti-nuke triggers |
| Raid in progress | The whole server | /lockall, or automatic anti-raid lockdown on Premium |
| Compromised admin account | The account, then the server | Strip roles, /lockall, review the logs |
Do this with Security Bot
Discord Moderation Bot: Give staff moderation tools without handing out risky Discord permissions across the server.
Security Bot gives moderators ban, kick, softban, mute, lock, and clear commands. You get per-user access, a cap on bot bans and kicks, and a moderation log. Staff can moderate through the bot without Ban Members, Manage Channels, or Administrator on their role.
Frequently asked questions
How do I lock a role in Discord?
Place it above the roles that should not edit it, limit Manage Roles to the owner and one admin, and turn on the anti-nuke triggers that revert dangerous permission edits and admin role assignments and punish whoever made them.
How do I lock a Discord channel?
Deny Send Messages for @everyone in the channel permissions, or run /lock with Security Bot. Use /lock channel:#general time:10m for a timed lock.
How do I lock down a whole Discord server?
Run /lockall with Security Bot to deny Send Messages to @everyone in every text channel it can manage, or remove Send Messages from the @everyone role manually. Pause invites at the same time.
Can a bot lock the server automatically during a raid?
Yes. On Premium, Security Bot's anti-raid module locks the channels you selected for a set duration when the join score reaches your limit.
Do moderators need Manage Channels to lock channels?
Not with Security Bot. Grant them the Lock, Unlock, LockAll, and UnlockAll command permissions on the Moderation page instead.
How long should a lockdown last?
Until the cause is gone: flagged accounts punished, a compromised account stripped, spam cleared. Anti-raid reopens on its own after the lock duration you set. /lockall without a time stays until you run /unlockall.
Can I lock only some channels?
Yes. Use /lock on each channel you want closed. /lockall always covers every text channel the bot can manage, and the channel list on the Anti-Raid page only applies to automatic raid locks.
How this guide was made: drafted with AI assistance, then checked against Security Bot's source code and Discord's official help articles. Spotted something out of date? Tell us in the support server.