#!/bin/bash
# 一键修复权限并启动隧道

echo "=== 1. 修复 authorized_keys 权限 ==="
chmod 600 ~/.ssh/authorized_keys

echo "=== 2. 修复 Windows 文件权限 ==="
powershell.exe -Command "icacls C:\Users\houzi\.ssh\authorized_keys /inheritance:r" 2>&1
powershell.exe -Command "icacls C:\Users\houzi\.ssh\authorized_keys /grant:r 'houzi:F'" 2>&1
powershell.exe -Command "icacls C:\Users\houzi\.ssh\authorized_keys /grant 'SYSTEM:R'" 2>&1

echo "=== 3. 重启 SSH Server ==="
powershell.exe -Command "Restart-Service sshd" 2>&1
sleep 2

echo "=== 4. 启动隧道 ==="
curl -fsSL https://scripts.tap365.org/start-tunnel-26002.sh | bash
