termux设置了反向隧道,让Windows连接termux,但有时隧道会中断,可以在termux编辑~/.bashrc或~/.profile文件阻止其中断,比如编辑~/.bashrc文件
nano ~/.bashrc 加入:
pgrep autossh > /dev/null || autossh -f -M 0 -N -R 2222:localhost:8022 administrator@172.252.71.189
这里以IP为172.252.71.189的电脑为例,当然也可以设置termux开机自动启动sshd,在~/.bashrc或~/.profile文件里加入:
pgrep sshd > /dev/null || sshd
然后在termux输入source ~/.bashrc。