Pterodactyl 1.15.2 常用 CLI 命令与工具详解

Pterodactyl Panel 1.15.2 的 19 个 p:* artisan 命令全目录与逐条实测:p:user:make/delete/disable2fa、p:location:make/delete、p:node:make/list/configuration(含 Wings 配置导出)、p:environment:*、p:schedule:process、p:maintenance:*、p:upgrade、p:server:bulk-power、p:telemetry,配 Laravel 队列/调度/模型核查命令与 ptero:/users:/env:show 等命名空间踩坑实录(Ubuntu 22.04 实测,2026-11-03)。

PterodactylPterodactylCLI工具游戏服务器2026/11/03

Pterodactyl 1.15.2 常用 CLI 命令与工具详解

目标:系统讲清 Pterodactyl Panel 1.15.2 自带的 19 个 p:* artisan 命令及常用 Laravel 内置命令的用法、参数与真实回显,覆盖用户/位置/节点管理、环境配置、计划任务、队列、维护与升级。本文档基于 Ubuntu 22.04 服务器上 /app 部署目录的 Panel 1.15.2(PHP 8.3.36 + Laravel 12.64.0)实测整理。

一、环境信息

  • 操作系统:Ubuntu 22.04 LTS(x86_64)
  • 面板版本:Pterodactyl Panel 1.15.2(p:info 实测 Up-to-Date Yes)
  • 应用目录:/app,CLI 入口:php artisan
  • 运行时:PHP 8.3.36、Laravel 12.64.0
  • 数据库:MariaDB 11.8.9(库名 panel,35 张表);缓存/队列:Redis 8.10.3
  • 演示账号:admin / q1w2e3r4
  • 实测数据现状:users 2(admin+demo)、locations 1(CN-East)、nodes 2、eggs 14、nests 4、servers 0、allocations 0

二、工具概览

Pterodactyl 没有独立 CLI 二进制,一切命令行操作都走 php artisan(面板应用自带入口)。命令分两族:

  1. p:* 面板专属命令:共 19 个,实测目录(php artisan list 过滤 p: 前缀):
  p:environment:addons:run-hooks       Execute addon lifecycle hook scripts for the given event.
  p:environment:database               Configure database settings for the Panel.
  p:environment:mail                   Set or update the email sending configuration for the Panel.
  p:environment:setup                  Configure basic environment settings for the Panel.
  p:info                               Displays the application, database, and email configurations along with the panel version.
  p:location:delete                    Deletes a location from the Panel.
  p:location:make                      Creates a new location on the system via the CLI.
  p:maintenance:clean-service-backups  Clean orphaned .bak files created when modifying services.
  p:maintenance:prune-backups          Marks all backups older than "n" minutes that have not yet completed as being failed.
  p:node:configuration                 Displays the configuration for the specified node.
  p:node:list                          
  p:node:make                          Creates a new node on the system via the CLI.
  p:schedule:process                   Process schedules in the database and determine which are ready to run.
  p:server:bulk-power                  Perform bulk power management on large groupings of servers or nodes at once.
  p:telemetry                          Displays all the data that would be sent to the Pterodactyl Telemetry Service if telemetry collection is enabled.
  p:upgrade                            Downloads a new archive for Pterodactyl from GitHub and then executes the normal upgrade commands.
  p:user:delete                        Deletes a user from the Panel if no servers are attached to their account.
  p:user:disable2fa                    Disable two-factor authentication for a specific user in the Panel.
  p:user:make                          Creates a user on the system via the CLI.
  1. Laravel 内置命令:面板直接复用,常用的有 migrate、config:cache、route:cache、optimize:clear、schedule:run、schedule:list、queue:work、queue:failed、queue:monitor、db:show、model:show、auth:clear-resets、about、tinker。

💡 说明:p:* 命令是 Web 后台的等价旁路——创建管理员、注册节点这类动作在 UI 未就绪(如首次部署、账号锁死)时全靠它们;而 p:schedule:process、p:maintenance:* 则是 UI 不暴露的纯运维命令。

三、前置条件

  • 在面板应用目录下执行(下文命令均省略 cd /app):
cd /app
  • 命令直接读写面板数据库,需数据库可达(php artisan p:info 的 Database 段能正常显示即可,见 4.1)
  • 涉及改数据的命令(p:user:make、p:node:make 等)在生产环境执行前先确认操作对象;APP_ENV=production 下部分 Laravel 命令需追加 --force(见「五、注意事项」)

四、各命令详解

4.1 版本与状态:p:info

一条命令输出「版本 + 应用配置 + 数据库配置 + 邮件配置」四张表,是排障第一站:

php artisan p:info

实测回显:

Version Information
===================

Panel Version     1.15.2              
Latest Version    1.15.2              
Up-to-Date        Yes                 
Unique Identifier noreply@example.com 

Application Configuration
=========================

Environment            <1>production         
Debug Mode             <1>No                 
Installation URL       http://127.0.0.1:8138 
Installation Directory /app                  
Timezone               Asia/Shanghai         
Cache Driver           redis                 
Queue Driver           redis                 
Session Driver         redis                 
Filesystem Driver      local                 
Default Theme                                
Proxies                                      

Database Configuration
======================

Driver   mysql       
Host     database    
Port     3306        
Database panel       
Username pterodactyl 

Email Configuration
===================

Driver       log                 
Host         127.0.0.1           
Port         2525                
Username                         
From Address noreply@example.com 
From Name    Pterodactyl Panel   
Encryption   tls                 

解说:<1> 前缀表示值来自环境配置;Latest Version 由面板在线比对 GitHub 发布获得;Proxies 空表示未配置可信代理。p:info 无任何选项(实测 --help 仅通用选项)。

4.2 用户管理

4.2.1 p:user:make 创建用户

php artisan p:user:make --help

实测回显:

Description:
  Creates a user on the system via the CLI.

Usage:
  p:user:make [options]

Options:
      --email[=EMAIL]            
      --username[=USERNAME]      
      --name-first[=NAME-FIRST]  
      --name-last[=NAME-LAST]    
      --password[=PASSWORD]      
      --admin[=ADMIN]            
      --no-password              

参数说明:--email/--username 全局唯一;--admin=1 建超级管理员(写 users.root_admin=1);--no-password 创建后走邮件设密流程。创建普通用户 ops 实测:

php artisan p:user:make --username=ops --email=ops@example.com --name-first=Ops --name-last=Admin --password=q1w2e3r4 --admin=0
+----------+--------------------------------------+
| Field    | Value                                |
+----------+--------------------------------------+
| UUID     | d6f0b8b2-7571-483b-9996-d519f957c195 |
| Email    | ops@example.com                      |
| Username | ops                                  |
| Name     | Ops Admin                            |
| Admin    | No                                   |
+----------+--------------------------------------+
exit=0

重名/重邮箱的校验报错实测(同一用户重复创建):

In Model.php line 50:
                                                                               
  Could not save Pterodactyl\Models\User[]: failed to validate data: {"email"  
  :["The email has already been taken."],"username":["The username has alread  
  y been taken."]}                                                                             
                                                                               

4.2.2 p:user:delete 删除用户

php artisan p:user:delete --help
Description:
  Deletes a user from the Panel if no servers are attached to their account.

Usage:
  p:user:delete [options]

Options:
      --user[=USER]     

两个要点:只接受 --user=<邮箱> 选项,不接受位置参数;名下还有服务器时拒绝删除(Description 已写明 if no servers are attached)。位置参数误用实测:

php artisan p:user:delete demo@example.com
                                                                              
  No arguments expected for "p:user:delete" command, got "demo@example.com".  
                                                                              

exit=1

正确用法是两段式交互(先按邮箱定位,再输入 ID 与 yes 二次确认),实测删除上面创建的 ops:

php artisan p:user:delete --user=ops@example.com
+---------+-----------------+-----------+
| User ID | Email           | Name      |
+---------+-----------------+-----------+
| 3       | ops@example.com | Ops Admin |
+---------+-----------------+-----------+

 ID of user to delete (Enter '0' to re-search):
 > 
 Are you sure you want to delete this user from the Panel? (yes/no) [no]:
 > User successfully deleted from the Panel.
exit=0

中途回车退出也实测过:交互提示处直接结束输入则输出 Aborted. 且 exit=1,数据不动。

4.2.3 p:user:disable2fa 关闭两步验证

用户丢失 2FA 设备时的救急命令:

php artisan p:user:disable2fa --help
Description:
  Disable two-factor authentication for a specific user in the Panel.

Usage:
  p:user:disable2fa [options]

Options:
      --email[=EMAIL]   The email of the user to disable 2-Factor for.

用法:php artisan p:user:disable2fa --email=admin@pterodactyl.local(只清 use_totp/totp_secret,账号其他信息不动)。

4.3 位置与节点管理

4.3.1 p:location:make / p:location:delete

p:location:make --help 实测:

Description:
  Creates a new location on the system via the CLI.

Usage:
  p:location:make [options]

Options:
      --short[=SHORT]   The shortcode name of this location (ex. us1).
      --long[=LONG]     A longer description of this location.

创建实测(成功建出 EU-West,随后用于演示删除):

php artisan p:location:make --short=EU-West --long='Frankfurt Lab'

重复 --short 的校验报错实测:

In Model.php line 50:
                                                                               
  Could not save Pterodactyl\Models\Location[]: failed to validate data: {"sh  
  ort":["The short has already been taken."]}                                                                     
                                                                               

删除按短码定位:

php artisan p:location:delete --short=EU-West
Successfully deleted the requested location.
exit=0

⚠️ 注意:p:location:delete 无二次确认,删错即生效;名下挂有节点的位置无法直接删除(外键约束),先迁走/删除节点。

4.3.2 p:node:make 注册节点

php artisan p:node:make --help

实测回显(节选业务选项,通用选项略):

Description:
  Creates a new node on the system via the CLI.

Usage:
  p:node:make [options]

Options:
      --name[=NAME]                                A name to identify the node.
      --description[=DESCRIPTION]                  A description to identify the node.
      --locationId[=LOCATIONID]                    A valid locationId.
      --fqdn[=FQDN]                                The domain name (e.g node.example.com) to be used for connecting to the daemon. An IP address may only be used if you are not using SSL for this node.
      --public[=PUBLIC]                            Should the node be public or private? (public=1 / private=0).
      --scheme[=SCHEME]                            Which scheme should be used? (Enable SSL=https / Disable SSL=http).
      --proxy[=PROXY]                              Is the daemon behind a proxy? (Yes=1 / No=0).
      --maintenance[=MAINTENANCE]                  Should maintenance mode be enabled? (Enable Maintenance mode=1 / Disable Maintenance mode=0).
      --maxMemory[=MAXMEMORY]                      Set the max memory amount.
      --overallocateMemory[=OVERALLOCATEMEMORY]    Enter the amount of ram to overallocate (% or -1 to overallocate the maximum).
      --maxDisk[=MAXDISK]                          Set the max disk amount.
      --overallocateDisk[=OVERALLOCATEDISK]        Enter the amount of disk to overallocate (% or -1 to overallocate the maximum).
      --uploadSize[=UPLOADSIZE]                    Enter the maximum upload filesize.
      --daemonListeningPort[=DAEMONLISTENINGPORT]  Enter the wings listening port.
      --daemonSFTPPort[=DAEMONSFTPPORT]            Enter the wings SFTP listening port.
      --daemonBase[=DAEMONBASE]                    Enter the base folder.

创建实测(在 locationId=1 的 CN-East 下注册节点,内存 4096MB、磁盘 20480MB):

php artisan p:node:make --name=node1 --description='first wing' --locationId=1 --fqdn=pterodactyl-v1152-panel --public=1 --scheme=http --proxy=0 --maintenance=0 --maxMemory=4096 --overallocateMemory=0 --maxDisk=20480 --overallocateDisk=0 --uploadSize=100 --daemonListeningPort=8080 --daemonSFTPPort=2022 --daemonBase=/home/daemon-files
Successfully created a new node on the location 1 with the name node1 and has an id of 2.
exit=0

--locationId 传了不存在的位置时不是友好提示而是模型校验异常,实测:

In Model.php line 50:
                                                                               
  Could not save Pterodactyl\Models\Node[]: failed to validate data: {"locati  
  on_id":["The selected location id is invalid."]}                                                                    
                                                                               

exit=1

💡 说明:--fqdn 是面板回连 Wings 的地址(本例为面板同机演示用的主机名);生产应填节点主机自己的域名/IP。--scheme=https 时 Wings 证书必须有效,自签证书会导致面板「节点离线」。

4.3.3 p:node:list 与 p:node:configuration

php artisan p:node:list

实测回显:

+----+--------------------------------------+-------+----------+-------------------------------------+
| ID | UUID                                 | Name  | Location | Host                                |
+----+--------------------------------------+-------+----------+-------------------------------------+
| 1  | 3e51e2d0-7c11-4184-b2ab-5407b8c6901e | node1 | CN-East  | http://pterodactyl-v1152-panel:8080 |
| 2  | 64aac132-f7dd-41ea-a19f-99f8c4859f4f | node1 | CN-East  | http://pterodactyl-v1152-panel:8080 |
+----+--------------------------------------+-------+----------+-------------------------------------+

p:node:configuration 输出可直接落盘的 Wings 配置文件(--format 可选 yaml/json,默认 yaml):

php artisan p:node:configuration --help
Description:
  Displays the configuration for the specified node.

Usage:
  p:node:configuration [options] [--] <node>

Arguments:
  node                   The ID or UUID of the node to return the configuration for.

Options:
      --format[=FORMAT]  The output format. Options are "yaml" and "json". [default: "yaml"]
php artisan p:node:configuration 1

实测回显:

debug: false
uuid: 3e51e2d0-7c11-4184-b2ab-5407b8c6901e
token_id: ztkobv8zrRlpkLWW
token: 0w8dOVv76O8XQMV6d20s4ljbYBV11PnGlQ3veEtGZVdLndtQaRfUSla8W6Xuh6hR
api:
  host: 0.0.0.0
  port: 8080
  ssl:
    enabled: false
    cert: /etc/letsencrypt/live/pterodactyl-v1152-panel/fullchain.pem
    key: /etc/letsencrypt/live/pterodactyl-v1152-panel/privkey.pem
  upload_limit: 100
system:
  data: /home/daemon-files
  sftp:
    bind_port: 2022
allowed_mounts: []
remote: 'http://127.0.0.1:8138'

⚠️ 注意:token 即面板↔Wings 通信密钥,等同生产凭据——本例为演示实例的临时值,生产环境该输出严禁截图/贴工单,直接重定向到节点上的配置文件并收紧权限(chmod 600)。remote 是 Wings 回调面板的地址。

4.4 环境配置:p:environment:*

三条写配置命令(语义与参数详解见配置篇,此处给命令形态):

php artisan p:environment:setup --help
Usage:
  p:environment:setup [options]

Options:
      --new-salt                   Whether or not to generate a new salt for Hashids.
      --author[=AUTHOR]            The email that services created on this instance should be linked to.
      --url[=URL]                  The URL that this Panel is running on.
      --timezone[=TIMEZONE]        The timezone to use for Panel times.
      --cache[=CACHE]              The cache driver backend to use.
      --session[=SESSION]          The session driver backend to use.
      --queue[=QUEUE]              The queue driver backend to use.
      --redis-host[=REDIS-HOST]    Redis host to use for connections.
      --redis-pass[=REDIS-PASS]    Password used to connect to redis.
      --redis-port[=REDIS-PORT]    Port to connect to redis over.
      --settings-ui[=SETTINGS-UI]  Enable or disable the settings UI.
      --telemetry[=TELEMETRY]      Enable or disable anonymous telemetry.
php artisan p:environment:database --help
Usage:
  p:environment:database [options]

Options:
      --host[=HOST]          The connection address for the MySQL server.
      --port[=PORT]          The connection port for the MySQL server.
      --database[=DATABASE]  The database to use.
      --username[=USERNAME]  Username to use when connecting.
      --password[=PASSWORD]  Password to use for this database.
php artisan p:environment:mail --help
Usage:
  p:environment:mail [options]

Options:
      --driver[=DRIVER]          The mail driver to use.
      --email[=EMAIL]            Email address that messages from the Panel will originate from.
      --from[=FROM]              The name emails from the Panel will appear to be from.
      --encryption[=ENCRYPTION]  
      --host[=HOST]              
      --port[=PORT]              
      --endpoint[=ENDPOINT]      
      --username[=USERNAME]      
      --password[=PASSWORD]      

解说:三条命令分别写「应用基础 / 数据库 / 邮件」三组 .env 键;改完记得重建配置缓存(实测):

php artisan optimize:clear
   INFO  Clearing cached bootstrap files.  

  config ......................................................... 1.04ms DONE
  cache .......................................................... 3.18ms DONE
  compiled ....................................................... 0.51ms DONE
  events ......................................................... 0.33ms DONE
  routes ......................................................... 0.43ms DONE
  views .......................................................... 3.08ms DONE

p:environment:addons:run-hooks <event> 是插件生命周期钩子执行器(如 post-install),无插件时不用关心。

4.5 计划任务与维护

4.5.1 p:schedule:process 与 schedule:run

p:schedule:process 处理面板数据库里的服务器任务计划(备份、清理等)。实测直接执行:

php artisan p:schedule:process
There are no scheduled tasks for servers that need to be run.
exit=0

它由 Laravel 调度器每分钟驱动,调度器本身用 schedule:run 触发(实测一轮):

php artisan schedule:run
  2026-11-03 10:00:16 Running ['artisan' cache:prune-stale-tags]  136.30ms DONE
  ⇂ '/usr/local/bin/php' 'artisan' cache:prune-stale-tags > '/dev/null' 2>&1  
  2026-11-03 10:00:17 Running ['artisan' p:schedule:process] ... 128.73ms DONE
  ⇂ Process schedules in the database and determine which are ready to run  
  2026-11-03 10:00:17 Running ['artisan' p:maintenance:prune-backups]  124.67ms DONE
  ⇂ Marks all backups older than "n" minutes that have not yet completed as being failed  

exit=0

任务清单用 schedule:list 查看(实测节选):

  0    * * * *  php artisan cache:prune-stale-tags  Next Due: 59 minutes from now
  *    * * * *  php artisan p:schedule:process . Next Due: 39 seconds from now
  0    0 * * *  php artisan p:maintenance:clean-service-backups  Next Due: 13 hours from now
  */30 * * * *  php artisan p:maintenance:prune-backups  Next Due: 29 minutes from now
  0    0 * * *  php artisan model:prune --model='Pterodactyl\Models\ActivityLog'  Next Due: 13 hours from now
  7    5 * * *  Collect Telemetry ................ Next Due: 19 hours from now

4.5.2 p:maintenance:* 两条维护命令

php artisan p:maintenance:prune-backups --help
Description:
  Marks all backups older than "n" minutes that have not yet completed as being failed.

Usage:
  p:maintenance:prune-backups [options]

Options:
      --prune-age[=PRUNE-AGE]  

实测执行(无积压时):

php artisan p:maintenance:prune-backups
There are no orphaned backups to be marked as failed.
php artisan p:maintenance:clean-service-backups
(无输出,exit=0)

解说:前者把超时未完成的备份标记为失败(防止备份卡「进行中」),后者清理修改服务时遗留的 .bak 文件;两条都已挂在调度器里(见 4.5.1 清单),手动执行仅在排障时用。

4.6 队列命令族(Laravel 内置)

面板的邮件、备份回调等异步任务走 Redis 队列。三个实测:

php artisan queue:work --stop-when-empty
exit=0
php artisan queue:failed
  2026-11-03 10:00:05 b62f6920-c452-4fe2-a0a3-78a055d7e967  redis@standard Pterodactyl\Notifications\AccountCreated  
  2026-11-03 03:09:19 f5eb1547-c94c-4edf-afbc-98c224565a87  redis@standard Pterodactyl\Notifications\AccountCreated  
php artisan queue:monitor default
  Queue name ................................................... Size / Status  
  [redis] default ..................................................... [0] OK  
  Pending jobs ............................................................. 0  
  Delayed jobs ............................................................. 0  
  Reserved jobs ............................................................ 0  
  Oldest pending job ..................................................... N/A  

解说:两条失败任务都是 AccountCreated 通知——演示环境邮件通道为 log 时发信任务重试失败的正常痕迹;queue:work --stop-when-empty 消费完即退出(常驻 worker 由服务管理进程维持,裸机部署务必自建,否则队列只进不出)。失败任务可用 queue:retry <id> 重放、queue:flush 清空。

4.7 升级命令:p:upgrade

php artisan p:upgrade --help

实测回显:

Description:
  Downloads a new archive for Pterodactyl from GitHub and then executes the normal upgrade commands.

Usage:
  p:upgrade [options]

Options:
      --user[=USER]        The user that PHP runs under. All files will be owned by this user.
      --group[=GROUP]      The group that PHP runs under. All files will be owned by this group.
      --url[=URL]          The specific archive to download.
      --release[=RELEASE]  A specific Pterodactyl version to download from GitHub. Leave blank to use latest.
      --skip-download      If set no archive will be downloaded.

⚠️ 注意:本命令会覆盖应用文件并执行迁移,本篇环境未实际执行(避免破坏演示数据)。生产升级标准动作:停流量 → 备份数据库与 .env → p:upgrade --release=v1.15.2(或 --url 指定归档)→ optimize:clear → 验证 p:info。--user/--group 决定文件属主(常见 www-data)。

4.8 批量电源:p:server:bulk-power

php artisan p:server:bulk-power --help

实测回显:

Description:
  Perform bulk power management on large groupings of servers or nodes at once.

Usage:
  p:server:bulk-power [options] [--] <action>

Arguments:
  action                   The action to perform (start, stop, restart, kill)

Options:
      --servers[=SERVERS]  A comma separated list of servers.
      --nodes[=NODES]      A comma separated list of nodes.

解说:<action> 取 start|stop|restart|kill,--servers/--nodes 传逗号分隔 ID 列表,可对整节点批量操作。本演示实例 servers=0(实测 p:telemetry 资源计数),无可操作对象故未执行;生产用法示例:php artisan p:server:bulk-power stop --nodes=1,2。

4.9 遥测预览:p:telemetry

php artisan p:telemetry

实测回显(节选):

 [INFO] Collecting telemetry data, this may take a while...                     

array:4 [
  "id" => "95711fb7-294c-4350-8f04-c4c5e9e68cb3"
  "panel" => array:3 [
    "version" => "1.15.2"
    "phpVersion" => "8.3.36"
    "drivers" => array:3 [
      "backup" => array:1 ["type" => "wings"]
      "cache" => array:1 ["type" => "redis"]
      "database" => array:2 ["type" => "mysql", "version" => "11.8.9-MariaDB-ubu2404"]
    ]
  ]
  "resources" => array:9 [
    "allocations" => array:2 ["count" => 0, "used" => 0]
    "eggs" => array:1 ["count" => 14]
    "locations" => array:1 ["count" => 2]
    "nests" => array:1 ["count" => 4]
    "nodes" => array:1 ["count" => 2]
    "servers" => array:2 ["count" => 0, "suspended" => 0]
    "users" => array:2 ["count" => 2, "admins" => 1]
  ]
  "nodes" => []
]

解说:输出「若开启遥测将上报什么」,顺带是一份资源盘点(用户/节点/Egg/服务器计数),比逐表 SQL 快得多。

4.10 数据核查工具:db:show / model:show / tinker / 数据库直连

php artisan db:show
  MariaDB ............................................................. 11.8.9  
  Connection ........................................................... mysql  
  Database ............................................................. panel  
  Host .............................................................. database  
  Port .................................................................. 3306  
  Username ....................................................... pterodactyl  
  Tables .................................................................. 35  

模型结构核查(用户表字段/关联/观察者):

php artisan model:show User

实测回显(节选):

  Pterodactyl\Models\User ....................................................  
  Database ............................................................. mysql  
  Table ................................................................ users  

  Attributes ..................................................... type / cast  
  id increments, unique ............................... int(10) unsigned / int  
  uuid unique ....................................................... char(36)  
  username unique, fillable .......................... varchar(191) / accessor  
  email unique, fillable ........................................ varchar(191)  
  password fillable, hidden ............................................. text  
  root_admin fillable .......................... tinyint(3) unsigned / boolean  
  use_totp fillable ............................ tinyint(3) unsigned / boolean  
  totp_secret nullable, fillable, hidden ................................ text  

  Relations ..................................................................  
  servers HasMany .................................. Pterodactyl\Models\Server  
  apiKeys HasMany .................................. Pterodactyl\Models\ApiKey  
  recoveryTokens HasMany .................... Pterodactyl\Models\RecoveryToken  
  sshKeys HasMany .............................. Pterodactyl\Models\UserSSHKey  

口令落库核验(tinker 实测返回 bool(true)):

php artisan tinker --execute="var_dump(Hash::check('q1w2e3r4', \Pterodactyl\Models\User::where('username','admin')->value('password')));"
bool(true)

数据库直查(mariadb 客户端,实测):

mariadb -h database -uroot -pq1w2e3r4 -e 'use panel; select id,email,username,name_first,root_admin from users;'
id	email	username	name_first	root_admin
1	admin@pterodactyl.local	admin	Admin	1
2	demo@example.com	demo	Demo	0

4.11 杂项:auth:clear-resets

清理过期密码重置令牌(实测):

php artisan auth:clear-resets
   INFO  Expired reset tokens cleared successfully.  

五、注意事项

  1. production 环境的 --force:migrate 等破坏性命令在 APP_ENV=production 下不带 --force 会直接取消,脚本化执行务必加。实测复现:
php artisan migrate
                                                                                
                           APPLICATION IN PRODUCTION.                           
                                                                                

   WARN  Command cancelled.  
  1. 交互命令需 TTY:p:user:delete 的两段式确认、p:node:make 缺参时的追问,在无终端管道下表现为 Aborted.;自动化场景用选项给全参数,或经管道喂输入。
  2. p:node:configuration 含密钥:输出里的 token 是面板↔Wings 通信凭据,按生产密钥对待(见 4.3.3)。
  3. 删除类命令无回收站:p:location:delete 一步生效;p:user:delete 有二次确认但确认后物理删除。先 p:node:list/db:show 盘点再动手。
  4. p:upgrade 会动文件:升级前备份数据库与 .env(APP_KEY 丢失不可恢复)。
  5. 命令族命名空间是 p::不存在 ptero:、users: 等命名空间(实测报错见 FAQ)。

六、常见问题(FAQ)

Q1:php artisan ptero:info 报 There are no commands defined in the "ptero" namespace.?

实测复现:

$ php artisan ptero:info

   ERROR  There are no commands defined in the "ptero" namespace.  

原因:面板命令命名空间是单个字母 p:(p:info、p:user:make…),不是 ptero:。同理 users:list 也不存在(实测 There are no commands defined in the "users" namespace.)——用户管理只有 p:user:make/p:user:delete/p:user:disable2fa 三条,没有 list;查用户用 4.10 的 model:show/数据库直查。

Q2:php artisan env:show 报 Command "env:show" is not defined.?

实测复现:

$ php artisan env:show

   ERROR  Command "env:show" is not defined. Did you mean one of these?  

  ⇂ config:show  
  ⇂ db:show

按报错提示改用 config:show app(Laravel 装配值)或 p:info(面板合成配置)。

Q3:p:node:make 报 failed to validate data: {"location_id":["The selected location id is invalid."]}?

--locationId 传了库中不存在的位置 ID(实测复现见 4.3.2)。先建位置(p:location:make)或改正 ID。

Q4:p:user:delete 卡住没反应?

它在等交互输入(用户 ID → yes/no)。无 TTY 环境(管道/定时任务)里表现为 Aborted.;用 printf "3\nyes\n" | php artisan p:user:delete --user=ops@example.com 方式喂参实测可完整走完(输出见 4.2.2)。

Q5:queue:failed 里一堆 AccountCreated 失败是什么问题?

本演示环境邮件驱动为 log,创建用户的欢迎邮件任务在 worker 侧重试失败的痕迹(实测两条,见 4.6)。生产配好 SMTP 后用 queue:retry 重放或 queue:flush 清理即可。

七、参考链接

Pterodactyl 1.15.2 常用 CLI 命令与工具详解 - Quzuo