宝塔从7.4.5版本开始,宝塔安装后首页强制绑定手机号码
关闭宝塔安全入口
rm -f /www/server/panel/data/admin_path.pl

sed -i "s|if (bind_user == 'True') {|if (bind_user == 'REMOVED') {|g" /www/server/panel/BTPanel/static/js/index.js
同理,如果要还原
sed -i "s|if (bind_user == 'REMOVED') {|if (bind_user == 'True') {|g" /www/server/panel/BTPanel/static/js/index.js

方法2:修改首页html代码。猥琐点
文件路径/www/server/panel/BTPanel/templates/default/index.html

<script type="text/javascript">
    var bind_user =false ;//"{{data['bind']}}"
</script>

宝塔7.6.0安装后,会提示绑定宝塔账号,而且这个绑定和之前的绑定ui不一样了。
修改__init__.py
通过禁用/www/server/panel/BTPanel/__init__.py文件的某些代码来禁止绑定。我们通过路径找到__init__.py文件,这个如何找这个文件,可以用SFTP来连接到服务器,然后通过路径找到这个文件。拖到桌面用编辑器打开,比如说,sublime,editplus等等。
1)181-182行的代码注释掉,前面加#即可,如下。

 #if not public.is_bind():
#return redirect('/bind',302)

2)230-231行注释掉,如下:

 #if not os.path.exists('data/userInfo.json'):
#data['bind'] = os.path.exists('data/bind.pl')

3)ssh连接到服务器,输入bt命令,接着输入9,清除面板缓存即可。

标签: none

添加新评论