
* add rules * join date on profiles * deprecate follow scope * deprecate identity proofs * familiar followers * use definition lists instead of tables for defining activitypub properties * reformat notifications page into markdown * fix broken links to publicKey header * Application website is now nullable * update environment variables added and removed * fix typo * fix heading level * min_id and max_id can be used at the same time (3.3) * fix typo * new tootctl options * reformat tootctl page to use definition lists for params * add rules and configuration to Instance * fix typo * refactor instance api page * 3.3.0 duration on mutes * 3.3.0 mute_expires_at * improve section headings * 3.4.0 resend email confirmation api * 3.4.0 policy on push subscriptions * 3.4.0 add details to account registration error * refactor accounts api page and start adding relrefs to entity pages * 3.4.0 accounts/lookup api * add see also to accounts methods * add more see-also links * 3.5.0 appeal mod decisions * 3.5.0 reformat reports and add category/rule_ids params * document report entity and missing responses * fix typos * fix relrefs and url schema, add aliases to old urls * add archetypes for new methods/entities * update archetypes with see-also stubs * clearer presentation of rate limits * announcements api methods * refactor apps methods * refactor bookmarks methods + some anchors * refactor conversations methods * custom_emojis methods refactor * anchors * refactor directory methods * refactor domain_blocks methods * add see also to emails methods * fix page relref shortcodes to specific methods + refactor endorsements methods * min_id max_id * refactor favourites methods * refactor featured_tags methods * refactor filters methods, make path params consistent, i18n required shortcode * follow_requests methods * lists methods * markers methods * forgot to add entity links * media methods, also fix formatting of some json errors * mutes methods, add more see-also links * oembed methods * preferences methods * proofs methods * push methods * suggestions methods * 3.5.0 add new trend types, fix formatting * refactor streaming methods * refactor oauth methods * note that streaming api casts payload to string * refactor search methods * refactor polls methods * remove unnecessary link * reformat scheduled_statuses methods * reformat timelines methods * reformat statuses methods * 3.5.0 editing statuses * consistent use of array brackets in form data parameters * update dev setup guide, add vagrant and clean up text * add admin/accounts methods * 3.6 role entity * admin/accounts methods v2 * minor fix * stub admin/reports methods * document admin reports * add 403 example to methods archetype * cleanup entities for admin reports and add new attrs * 3.6.0 domain allows methods + normalize admin entity namespace * fix search-and-replace error * add aliases for admin entities * 3.6.0 canonical email blocks entity * 3.5.0 admin/retention api * 3.5.0 add admin::ip doc * 3.5.0 admin/reports * 3.6.0 admin/domain_allows * 3.5.0 admin/dimensions * 3.6.0 permissions and roles * minor formatting fix * add anchor link to headings * checkpoint * add update commands to dev env setup guide * change mentions of v3.6 to v4.0 * tootctl now uses custom roles * fix formatting * v2 instance api * update frontmatter, add better titles to pages * minor wording change * consistency * add more aliases * add placeholders and WIP notices * explain link pagination and stub out todos * switch baseURL to https * 422 on reports with rules but category!=violation * document bug fixes * fix typo * remove duplicate API method definition * s/tootsuite/mastodon for github links * remove unnecessary escaping * s/tootsuite/mastodon in Entity archetype * add missing nullable shortcode * clarify oauth scope when requesting a user token * api/v2/media now synchronous for images * DISALLOW_UNAUTHENTICATED_API_ACCESS * add undocumented env variables * add instance domain blocks and extended description api * add SMTP_ENABLE_STARTTLS * add description to SMTP_ENABLE_STARTTLS * take suggestions from open PRs * normalize links and flavour language * Fully document streaming API based on source code * Add mention of MIME types * bump to ruby 3.0.4 * clarify how to check on async media processing * validation of replies_policy * remove TODOs on admin account action * EmailDomainBlocks * IpBlocks * Admin::DomainBlock * remove TODOs * following hashtags * followed_tags * remove reference to unused parameter * add new oauth scopes for admin blocks and allows * fix command signature for i18n-tasks normalize * reformat code structure page * document fixes for following tags (assume 4.0.3) * Add warning about pre-4.0 hardcoded roles * add note about case sensitivity * remove use of 'simply' from docs * remove reference to silencing * add reference to IDN normalization for verified links * add lang parameter
23 KiB
title | description | menu | ||||||
---|---|---|---|---|---|---|---|---|
Using the admin CLI | tootctl commands that can be run from the CLI. |
|
The command-line interface of Mastodon is an executable file called tootctl
residing in the bin
directory within the Mastodon root directory. You must specify which environment you intend to use whenever you execute it by specifying the RAILS_ENV
environment variable. Unless you are a developer working on a local machine, you need to use RAILS_ENV=production
. If you are sure that you will never need another environment (for development, testing, or staging), you can add it to your .bashrc
file for convenience, e.g.:
echo "export RAILS_ENV=production" >> ~/.bashrc
If so, you won’t need to specify it each time inline. Otherwise, calls to tootctl
will usually go like this, assuming that the Mastodon code is checked out in /home/mastodon/live
:
cd /home/mastodon/live
RAILS_ENV=production bin/tootctl help
Base CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/cli.rb" caption="lib/cli.rb" >}}
tootctl self-destruct
Erase this server from the federation by broadcasting account Delete activities to all known other servers. This allows a "clean exit" from running a Mastodon server, as it leaves next to no cache behind on other servers. This command is always interactive and requires confirmation twice.
No local data is actually deleted, because emptying the database or deleting the entire VPS is faster. If you run this command then continue to operate the instance anyway, then there will be a state mismatch that might lead to glitches and issues with federation.
{{< hint style="danger" >}} Make sure you know exactly what you are doing before running this command. This operation is NOT reversible, and it can take a long time. The server will be in a BROKEN STATE after this command finishes. A running Sidekiq process is required, so do not shut down the server until the queues are fully cleared. {{< /hint >}}
--dry-run
- Print expected results only, without performing any actions.
Version history:
2.8.0 - added
tootctl --version
Show the version of the currently running Mastodon instance.
Version history:
2.7.0 - added
Accounts CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/accounts_cli.rb" caption="lib/mastodon/accounts_cli.rb" >}}
tootctl accounts rotate
Generate and broadcast new RSA keys, as part of security maintenance.
USERNAME
- Local username for an account.
--all
- Can be provided instead of
USERNAME
to rotate keys for all local accounts.
Version history:
2.5.0 - added
tootctl accounts create
Create a new user account with given USERNAME
and provided --email
.
USERNAME
- Local username for the new account. {{}}
--email EMAIL
- Email address to be attached to the user. {{}}
--confirmed
- Skip sending the confirmation email and activate the account immediately.
--role ROLE
- Define the new account's custom role by providing the
name
of that [Role]({{< relref "entities/Role" >}}). Default roles includeOwner
,Admin
, andModerator
. --reattach
- Reuse an old USERNAME after its account has been deleted.
--force
Forcefully delete any existing account with this USERNAME
and reattach the new account in place of the (just-deleted) account.
--skip-sign-in-token
- Forcefully ensure that the user is never asked for an e-mailed security code.
Version history:
2.6.0 - added
4.0.0 - --role
no longer takes hard-coded user
, moderator
, or admin
roles. Specify the name of the custom Role instead.
tootctl accounts modify
Modify a user account's role, email, active status, approval mode, or 2FA requirement.
USERNAME
- Local username for the account. {{}}
--role ROLE
- Define the existing account's custom role by providing the
name
of that [Role]({{< relref "entities/Role" >}}). Default roles includeOwner
,Admin
, andModerator
. --email EMAIL
- Update the user's email address to
EMAIL
. --confirm
- Skip confirmation email, when used with
--email
. --disable
- Lock
USERNAME
out of their account. --enable
- Unlock
USERNAME
's account if it is currently disabled. --approve
- Approve
USERNAME
's account, if you are/were in approval mode. --disable-2fa
- Remove additional factors and allow login with password.
--reset-password
- Resets the password of the given account.
--skip-sign-in-token
- Forcefully ensure that the user is never asked for an e-mailed security code.
Version history:
2.6.0 - added
3.1.2 - added --reset-password
4.0.0 - --role
no longer takes hard-coded user
, moderator
, or admin
roles. Specify the name of the custom Role instead.
tootctl accounts delete
Delete a user account with given USERNAME.
USERNAME
- Local username for the new account. {{}}
Version history:
2.6.0 - added
tootctl accounts backup
Request a backup for a user account with given USERNAME. The backup will be created in Sidekiq asynchronously, and the user will receive an email with a link to it once it's done.
USERNAME
- Local username for the new account. {{}}
Version history:
2.6.0 - added
tootctl accounts cull
Remove remote accounts that no longer exist. Queries every single remote account in the database to determine if it still exists on the origin server, and if it doesn't, then remove it from the database. Accounts that have had confirmed activity within the last week are excluded from the checks, in case the server is just down.
DOMAIN[...]
- Optionally pass specific domains to cull
--concurrency N
- The number of workers to use for this task. Defaults to N=5.
--dry-run
- Print expected results only, without performing any actions.
Version history:
2.6.0 - added
2.8.0 - add --dry-run
3.5.0 - add ability to pass specific domains
tootctl accounts refresh
Refetch remote user data and files for one or multiple accounts.
USERNAME
- username@domain for the remote account.
--all
- Can be provided instead of
USERNAME
to refresh all remote accounts. --domain DOMAIN
- Can be provided instead of
USERNAME
. Operate only on remote accounts from thisDOMAIN
. --concurrency N
- The number of workers to use for this task. Defaults to N=5.
--verbose
- Print additional information while task is processing.
--dry-run
- Print expected results only, without performing any actions.
Version history:
2.6.0 - added
tootctl accounts merge
Merge two remote accounts into one. This is primarily meant to fix duplicates caused by other servers changing their domain. By default, this only works if the public key is the same, but this can be overridden.
FROM
- username@domain for the remote account to be removed. {{}}
TO
- username@domain for the remote account to be kept. {{}}
--force
- Override the public key check.
Version history:
3.3.0 - added
tootctl accounts follow
Force all local accounts to follow a local account specified by username.
USERNAME
- Local username. {{}}
--concurrency N
- The number of workers to use for this task. Defaults to N=5.
--verbose
- Print additional information while task is processing.
Version history:
2.7.0 - added
3.0.0 - now uses USERNAME
instead of ACCT
tootctl accounts unfollow
Force all local accounts to unfollow an account specified by their address.
ACCT
username@domain
address. {{}}--concurrency N
- The number of workers to use for this task. Defaults to N=5.
--verbose
- Print additional information while task is processing.
Version history:
2.7.0 - added
tootctl accounts reset-relationships
Reset all follow and/or follower relationships for a local account.
USERNAME
- Local username.
--follows
- Force
USERNAME
to unfollow everyone, then re-follow them. --followers
- Remove all of
USERNAME
's followers.
Version history:
2.8.0 - added
tootctl accounts approve
Approve new registrations when instance is in approval mode.
USERNAME
- Local username.
--number N
- Approve the N most recent registrations.
--all
- Approve all pending registrations.
Version history:
2.8.0 - added
Cache CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/cache_cli.rb" caption="lib/mastodon/cache_cli.rb" >}}
tootctl cache clear
Clear out the cache storage.
Version history:
2.8.1 - added
tootctl cache recount
Update hard-cached counters of TYPE by counting referenced records from scratch. It may take a very long time to finish, depending on the size of the database. Accounts will have their follower, following, and status counts refreshed. Statuses will have their reply, boost, and favourite counts refreshed.
TYPE
- Either
accounts
orstatuses
. {{}} --concurrency N
- The number of workers to use for this task. Defaults to N=5.
--verbose
- Print additional information while task is processing.
Version history:
3.0.0 - added
Domains CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/domains_cli.rb" caption="lib/mastodon/domains_cli.rb" >}}
tootctl domains purge
Remove all accounts from a given DOMAIN without leaving behind any records. Unlike a suspension, if the DOMAIN still exists in the wild, it means the accounts could return if they are resolved again.
DOMAIN[...]
- Domains to purge, separated by space.
--by-uri
- Match domains in the actor URI rather than in the Webfinger address.
--limited-federation-mode
- Can be provided instead of DOMAIN. Instead of purging from a single domain, all accounts from domains that are not allow-listed will be removed from the database. Use this after enabling limited federation mode and defining your allow-list.
--concurrency N
- The number of workers to use for this task. Defaults to 5.
--verbose
- Print additional information while task is processing.
--dry-run
- Print expected results only, without performing any actions.
Version history:
2.6.0 - added
2.8.0 - add --whitelist-mode
2.9.0 - remove custom emoji as well
3.0.0 - accept multiple domains
3.2.0 - rename --whitelist-mode
to --limited-federation-mode
3.5.0 - add --by-uri
tootctl domains crawl
Crawl the known fediverse by using Mastodon REST API endpoints that expose all known peers, and collect statistics from those peers, as long as those peers support those API endpoints. When no START is given, the command uses the server's own database of known peers to seed the crawl. Returns total servers, total registered users, total active users in the last week, and total users joined in the last week.
START
- Optionally start from a different domain name.
--exclude-suspended
- Do not include instances that you have suspended in the output. Also includes any subdomains.
--concurrency N
- The number of workers to use for this task. Defaults to N=50.
--format FORMAT
- Control how results are returned.
summary
will print a summary.domains
will return a newline-delimited list of all discovered peers.json
will dump aggregated raw data. Defaults tosummary
.
Version history:
2.7.0 - added
3.0.0 - add --exclude-suspended
Email domain blocks CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/email_domain_blocks_cli.rb" caption="lib/mastodon/email_domain_blocks_cli.rb" >}}
tootctl email-domain-blocks list
List all currently blocked email domains.
Version history:
3.2.0 - added
tootctl email-domain-blocks add
Add entries to the email domain blocklist.
DOMAIN[...]
- Email domains to block, separated by space. {{}}
--with-dns-records
- If provided, will also lookup A, AAAA, and MX records and block them as well.
Version history:
3.2.0 - added
tootctl email-domain-blocks remove
Remove entries from the e-mail domain blocklist.
DOMAIN[...]
- Email domains to unblock, separated by space. {{}}
Version history:
3.2.0 - added
Emoji CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/emoji_cli.rb" caption="lib/mastodon/emoji_cli.rb" >}}
tootctl emoji export
Exports custom emoji to export.tar.gz
at PATH.
PATH
- Path to create a .tar.gz archive containing pictures. {{}}
--overwrite
- Overwrite any existing archive at
PATH
. --category CATEGORY
- Export only the specified
CATEGORY
. If not provided, will export all emoji.
Version history:
3.1.4 - added
tootctl emoji import
Imports custom emoji from a .tar.gz archive at a given path. The archive should contain PNG or GIF files no larger than 50KB, and the shortcode will be set equal to the filename minus the extension, with optional prefixes and/or suffixes.
PATH
- Path to create a .tar.gz archive containing pictures. {{}}
--prefix PREFIX
- Add PREFIX to the beginning of generated shortcodes.
--suffix SUFFIX
- Add SUFFIX to the end of generated shortcodes.
--overwrite
- Instead of skipping existing emoji, replace them with any discovered emoji with the same shortcode.
--category CATEGORY
- Group the processed emoji under CATEGORY in the picker.
--unlisted
- Processed emoji will not be shown in the emoji picker, but will be usable only by their direct shortcode.
Version history:
2.5.0 - added
tootctl emoji purge
Remove all custom emoji.
--remote-only
- If provided, remove only from remote domains.
Version history:
2.8.0 - added
3.1.0 - add --remote-only
Feeds CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/feeds_cli.rb" caption="lib/mastodon/feeds_cli.rb" >}}
tootctl feeds build
Build home and list feeds for one or all users. Feeds will be built from the database and cached in-memory with Redis. Mastodon manages home feeds for active users automatically.
USERNAME
- Local username whose feeds will be regenerated.
--all
- Can be provided instead of
USERNAME
to refresh all remote accounts. --concurrency N
- The number of workers to use for this task. Defaults to N=5.
--verbose
- Print additional information while task is processing.
--dry-run
- Print expected results only, without performing any actions.
Version history:
2.6.0 - added
tootctl feeds clear
Remove all home and list feeds from Redis.
Version history:
2.6.0 - added
Maintenance CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/maintenance_cli.rb" caption="lib/mastodon/maintenance_cli.rb" >}}
tootctl maintenance fix-duplicates
Fix corrupted database indexes that may have been caused due to changing collation rules. Deletes or merges duplicate accounts, statuses, emojis, etc. Mastodon has to be stopped to run this task, which will take a long time and may be destructive. This is useful if your database indexes are corrupted because of issues such as https://wiki.postgresql.org/wiki/Locale_data_changes.
Version history:
3.3.0 - added
Media CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/media_cli.rb" caption="lib/mastodon/media_cli.rb" >}}
tootctl media remove
Remove locally cached copies of media attachments from other servers.
--days N
- How old media attachments have to be before they are removed. Defaults to 7.
--concurrency N
- The number of workers to use for this task. Defaults to N=5.
--verbose
- Print additional information while task is processing.
--dry-run
- Print expected results only, without performing any actions.
Version history:
2.5.0 - added
2.6.2 - show freed disk space
tootctl media remove-orphans
Scans for files that do not belong to existing media attachments, and remove them. Please mind that some storage providers charge for the necessary API requests to list objects. Also, this operation requires iterating over every single file individually, so it will be slow.
--start-after
- The Paperclip attachment key where the loop will start. Use this option if the command was interrupted before.
--dry-run
- Print expected results only, without performing any actions.
--prefix
- Traverse only a specific prefix of files in the system.
--fix-permissions
- Sets S3 ACL to be default according to environment variables.
Version history:
3.1.0 - added
3.1.3 - added --prefix
3.3.0 - added --fix-permissions
tootctl media refresh
Refetch remote media attachments from other servers. You must specify the source of media attachments with either --status
, --account
, or --domain
. If an attachment already exists in the database, it will not be overwritten unless you use --force
.
--account ACCT
- String
username@domain
handle of the account --domain DOMAIN
- FQDN string
--status ID
- Local numeric ID of the status in the database.
--concurrency N
- The number of workers to use for this task. Defaults to 5.
--verbose
- Print additional information while task is processing.
--dry-run
- Print expected results only, without performing any actions.
--force
- Force redownload the remote resource and overwrite the local attachment.
Version history:
3.0.0 - added
3.0.1 - add --force
and skip already downloaded attachments by default
tootctl media usage
Calculate disk space consumed by Mastodon.
Version history: 3.0.1 - added
tootctl media lookup
Prompts for a media URL, then looks up the status where the media is displayed.
Version history:
3.1.0 - added
Preview Cards CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/preview_cards_cli.rb" caption="lib/mastodon/preview_cards_cli.rb" >}}
tootctl preview_cards remove
Remove local thumbnails for preview cards.
--days N
- How old media attachments have to be before they are removed. Defaults to 180. (NOTE: it is not recommended to delete preview cards within the last 14 days, because preview cards will not be refetched unless the link is reposted after 2 weeks from last time.)
--concurrency N
- The number of workers to use for this task. Defaults to N=5.
--verbose
- Print additional information while task is processing.
--dry-run
- Print expected results only, without performing any actions.
--link
- Only delete link-type preview cards; leave video and photo cards untouched.
Version history:
3.0.0 - added
Search CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/search_cli.rb" caption="lib/mastodon/search_cli.rb" >}}
tootctl search deploy
Create or update an ElasticSearch index and populate it. If ElasticSearch is empty, this command will create the necessary indices and then import data from the database into those indices. This command will also upgrade indices if the underlying schema has been changed since the last run.
--batch-size
- Defaults to 1000. A lower batch size can make ElasticSearch process records more quickly.
--only INDEX
- Specify an index name [
accounts
,tags
,statuses
] to create or update only that index. --concurrency N
- Parallelize execution of the command on multiple threads. Defaults to N=2.
Version history:
2.8.0 - added
3.0.0 - add --processes
for parallelization
3.3.0 - options changed
3.5.0 - add --batch-size
Settings CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/settings_cli.rb" caption="lib/mastodon/settings_cli.rb" >}}
tootctl settings registrations open
Opens registrations.
Version history:
2.6.0 - added
tootctl settings registrations close
Closes registrations.
Version history:
2.6.0 - added
tootctl settings registrations approved
Set registration to require approval.
Version history:
3.5.2 - added
--require_reason
- If true, users must enter a reason when registering.
Statuses CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/statuses_cli.rb" caption="lib/mastodon/statuses_cli.rb" >}}
tootctl statuses remove
Remove unreferenced statuses from the database, such as statuses that came from relays or from users who are no longer followed by any local accounts, and have not been replied to or otherwise interacted with.
This is a computationally heavy procedure that creates extra database indices before commencing, and removes them afterward.
--days N
- How old statuses have to be before they are removed. Defaults to 90.
--skip-media-remove
- Skips removing the media, in case S3 errors out. Defaults to false.
Version history:
2.8.0 - added
3.1.3 - added --skip-media-remove
3.5.0 - now removes orphaned records and performs additional cleanup tasks
Upgrade CLI
{{< caption-link url="https://github.com/mastodon/mastodon/blob/master/lib/mastodon/upgrade_cli.rb" caption="lib/mastodon/upgrade_cli.rb" >}}
tootctl upgrade storage-schema
Upgrade the storage schema to store all non-local media resources in a top-level cache directory. WARNING: This is optional, and only for deployments made before v3.1.4. This command can incur massive object storage costs due to moving potentially terabytes of data.
--verbose
- Print additional information while task is processing.
--dry-run
- Print expected results only, without performing any actions.
Version history:
3.1.4 - added