# HostPanel安全建议

**HostPanel官网** [**https://hostpanel.cc**](https://hostpanel.cc)

**HostPanel站长交流群** [**https://t.me/hostpanelg**](https://t.me/hostpanelg)

### 安全**配置** <a href="#safe-config" id="safe-config"></a>

建议环境安装完毕后打开HostPanel一键真离线模式；

禁止数据库等端口的外网访问；&#x20;

使用三方插件时可以自行审计代码；

修改默认用户名及密码；

开启双因子认证（2FA）;

### **修改面板默认配置** <a href="#change-default" id="change-default"></a>

修改默认SSH端口；

登陆宝塔面板->安全 启用SSH 关闭；以免ssh root密码被暴力破解，禁止ssh登陆，只能宝塔登陆；

登陆宝塔面板->面板设置->面板端口 修改默认端口；以免被批量扫描到宝塔端口、定向爆破；

登陆宝塔面板->面板设置->安全入口 修改宝塔路径；

登陆宝塔面板->面板设置->修改面板用户 和 面板密码;

### 善用计划任务+自动备份 <a href="#backup" id="backup"></a>

如：应用商店中搜索【谷歌云网盘】或其他网盘并安装、配置

然后通过计划任务，分别创建两条定时备份：备份网站程序/目录、备份数据库 到谷歌网盘；

### 删除登录日志 <a href="#delete-log" id="delete-log"></a>

部分用户可能有这个需要；

以下为Centos清理ssh登录日志，其他系统请自行搜索命令；

```
cat /dev/null > /var/log/boot.log
cat /dev/null > /var/log/btmp
cat /dev/null > /var/log/cron
cat /dev/null > /var/log/dmesg
cat /dev/null > /var/log/firewalld
cat /dev/null > /var/log/grubby
cat /dev/null > /var/log/lastlog
cat /dev/null > /var/log/mail.info
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/messages
cat /dev/null > /var/log/secure
cat /dev/null > /var/log/spooler
cat /dev/null > /var/log/syslog
cat /dev/null > /var/log/tallylog
cat /dev/null > /var/log/wpa_supplicant.log
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/yum.log
```


---

# 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://hostpanel.gitbook.io/untitled/hostpanel-an-quan-jian-yi.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.
