这篇文章上次修改于 199 天前,可能其部分内容已经发生变化,如有疑问可询问作者。

配置Clash

mv clash-linux-amd64-v1.11.8.gz clash.gz

# 解压

gzip -dc clash.gz > /usr/local/bin/clash

# 加运行权限

chmod +x /usr/local/bin/clash

rm -f clash.gz

# 进入配置文件中粘贴Country.mmdb
cd /root/.config/clash/ 

#运行
./clash
/usr/local/bin/clash

# 进入配置文件中删除原始的配置文件
cd /root/.config/clash/ 
rm -rf config.yaml

# 下载订阅中的配置文件
wget -O config.yaml https://browser.networkwebmail.com/link/vp72EQ6BnTcNVVRF?clash=1
wget -O config.yaml https://sub-2.sockboom.pro/sub?target=clash&new_name=true&url=https%3A%2F%2Fsockboom.me%2Flink%2FpxXhMAb6osoEqFSS%3Fmu%3D1&filename=Sockboom&udp=true&config=https%3A%2F%2Fconfig.sockboom.me%2Fsubconfig.ini


# 测试文件是否可用
./clash -t
/usr/local/bin/clash -t

# 下载图形化界面
git clone -b gh-pages --depth 1 https://github.com/Dreamacro/clash-dashboard /opt/clash-dashboard

# 创建 systemd 脚本
vim  /etc/systemd/system/clash.service     

创建 systemd 脚本,脚本文件路径为 /etc/systemd/system/clash.service,内容如下:

[Unit]
Description=clash daemon

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/clash -d /root/.config/clash/
Restart=on-failure

[Install]
WantedBy=multi-user.target

重载 systemctl daemon

systemctl daemon-reload

设置系统代理

vim /etc/profile.d/proxy.sh  
export http_proxy="127.0.0.1:7890"
export https_proxy="127.0.0.1:7890"
export no_proxy="localhost, 127.0.0.1"

重载 /etc/profile 配置

source /etc/profile     

修改 clash 配置文件中 external-ui 的值为 /opt/clash-dashboard

vim /root/.config/clash/config.yaml   

在secret: ' '和proxies:中间添加

secret: ''
external-ui: /opt/clash-dashboard
systemctl status clash  
systemctl start clash   
systemctl restart clash
systemctl stop clash    
systemctl enable clash      
ps -aux | grep clash     
curl google.com  

通过浏览器访问 localhost:9090/ui,其中 localhost 替换为 clash 部署服务器的 IP

配置定时更新订阅

使用如下脚本填写相关配置项目并放入 /etc/cron.weekly 目录下,每周自动更新订阅配置文件即可

/etc/cron.weekly/clash.sh

#!/usr/bin/env bash

# 订阅链接地址
SUBSCRIBE=""
# web-ui存放目录,留空则保持默认不修改
WEB_UI=""
# API 端口,留空则保持默认不修改
CONTROLLER_API_PROT=""
# API 口令,留空则保持默认不修改
SECRET=""

CLASH_CONFIG="/etc/clash/config.yaml"


if [ -z "${SUBSCRIBE}" ]; then
    echo "Subscription address cannot be empty"
    exit 1
fi

systemctl stop clash

wget --no-proxy -O ${CLASH_CONFIG} ${SUBSCRIBE}

if [ -n "${WEB_UI}" ]; then
sed -i "s?^#\{0,1\} \{0,1\}external-ui.*?external-ui: ${WEB_UI}?" ${CLASH_CONFIG}
fi

if [ -n "${CONTROLLER_API_PROT}" ]; then
sed -i "s?^external-controller.*?external-controller: '0.0.0.0:${CONTROLLER_API_PROT}'?" ${CLASH_CONFIG}
fi

if [ -n "${SECRET}" ]; then
sed -i "s?^secret.*?secret: '${SECRET}'?" ${CLASH_CONFIG}
fi

systemctl start clash

上述脚本写入 /etc/cron.weekly/clash.sh 并配置好相关变量后,保存退出并赋予可执行权限

chmod 0755 /etc/cron.weekly/clash.sh

Kali换源

vim /etc/apt/sources.list

deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib

deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib

忘记密码

1、重启后进入菜单后,选择 “Advanced options for Kali GNU/Linux”

不需要选择,直接按E键。

2、找到 "Linux "开头的那行。

在Linux部分中,将’ ro_single ‘中的’ o ‘替换为’ w ‘。并在本行末,空格后添加’init=/bin/bash’(注意:单引号在英文下输入)


3、按键盘上的 fn+f10。(有的可直接按f10)

在“#”旁 输入命令“passwd”,更改现有密码。

4、看到提示“密码更新成功”。代表重置密码成功。