# 宝塔面板命令大全/宝塔面板找回密码

### **宝塔站长群** [**https://TG.HostCLi.COM**](https://TG.HostCLi.COM)

### 管理宝塔 <a href="#bt" id="bt"></a>

宝塔工具箱 <mark style="color:green;">(包含下列绝大部分功能 直接ssh中执行bt命令 仅限6.x以上版本面板)</mark>

```
bt
```

> \===============宝塔面板命令行==================&#x20;
>
> (1) 重启面板服务                         (8) 改面板端口&#x20;
>
> (2) 停止面板服务                         (9) 清除面板缓存&#x20;
>
> (3) 启动面板服务                         (10) 清除登录限制&#x20;
>
> (4) 重载面板服务                         (11) 设置是否开启IP + User-Agent验证&#x20;
>
> **(5) 修改面板密码**                         (12) 取消域名绑定限制&#x20;
>
> (6) 修改面板用户名                      (13) 取消IP访问限制&#x20;
>
> (7) 强制修改MySQL密码              (14) 查看面板默认信息&#x20;
>
> (22) 显示面板错误日志                 (15) 清理系统垃圾&#x20;
>
> (23) 关闭BasicAuth认证              **(16) 修复面板(检查错误并更新面板文件到最新版)**&#x20;
>
> (24) 关闭动态口令认证                 (17) 设置日志切割是否压缩&#x20;
>
> (25) 设置是否保存文件历史副本   **(18) 设置是否自动备份面板**&#x20;
>
> (26) 关闭面板ssl                           (28) 修改面板安全入口&#x20;
>
> (0) 取消                                         (29) 取消访问设备验证
>
> \===============================================
>
> 请输入命令编号：5
>
> 然后 回车 即可修改面板密码

#### 找回密码/修改面板密码 <a href="#reset-password" id="reset-password"></a>

ssh命令行直接输入 **`bt 5`**，（bt和5之间有个空格）即可找回密码。

* 如遇面板异常、报错、无法登陆、忘记密码等情况，请通过SSH登陆root账号，然后输&#x5165;**`bt`**&#x547D;令，根据宝塔面板命令行的提示修改相关项目，清理缓存、重启面板；
* 如果输入 **`bt`** 或 **`bt default`** 命令无效，可以尝试 **`bt 16`** 修复面板，不影响网站和数据正常运行；或重新安装宝塔开心版需要开启 **`bt 18`** (18) 设置是否自动备份面板 。

停止

```
/etc/init.d/bt stop
```

启动

```
/etc/init.d/bt start
```

重启

```
/etc/init.d/bt restart
```

卸载

```
/etc/init.d/bt stop && chkconfig --del bt && rm -f /etc/init.d/bt && rm -rf /www/server/panel
```

查看当前面板端口

```
cat /www/server/panel/data/port.pl
```

修改面板端口，如要改成8881（centos 6 系统）

```
echo '8881' > /www/server/panel/data/port.pl && /etc/init.d/bt restart
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 8881 -j ACCEPT
service iptables save
service iptables restart
```

修改面板端口，如要改成8881（centos 7 系统）

```
echo '8881' > /www/server/panel/data/port.pl && /etc/init.d/bt restart
firewall-cmd --permanent --zone=public --add-port=8881/tcp
firewall-cmd --reload
```

强制修改MySQL管理(root)密码，如要改成123456

```
cd /www/server/panel && python tools.py root 123456
```

修改面板密码，如要改成123456

```
cd /www/server/panel && python tools.py panel 123456
```

查看宝塔日志

```
cat /tmp/panelBoot.pl
```

查看软件安装日志

```
cat /tmp/panelExec.log
```

站点配置文件位置

```
/www/server/panel/vhost
```

删除域名绑定面板

```
rm -f /www/server/panel/data/domain.conf
```

清理登陆限制

```
rm -f /www/server/panel/data/*.login
```

查看面板授权IP

```
cat /www/server/panel/data/limitip.conf
```

关闭访问限制

```
rm -f /www/server/panel/data/limitip.conf
```

查看许可域名

```
cat /www/server/panel/data/domain.conf
```

关闭面板SSL

```
rm -f /www/server/panel/data/ssl.pl && /etc/init.d/bt restart
```

查看面板错误日志

```
cat /tmp/panelBoot
```

查看数据库错误日志

```
cat /www/server/data/*.err
```

站点配置文件目录(nginx)

```
/www/server/panel/vhost/nginx
```

站点配置文件目录(apache)

```
/www/server/panel/vhost/apache
```

站点默认目录

```
/www/wwwroot
```

数据库备份目录

```
/www/backup/database
```

站点备份目录

```
/www/backup/site
```

站点日志

```
/www/wwwlogs
```

### **宝塔站长群** [**https://TG.HostCLi.COM**](https://TG.HostCLi.COM)

**End.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.hostcli.com/bt-command/btcode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
