termux 简单初始化操作

248 阅读1分钟
termux 简单初始化操作
  1. 切换 pkg 的国内镜像
sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.aliyun.com/termux/termux-packages-24 stable main@' $PREFIX/etc/apt/sources.list

sed -i 's@^\(deb.*games stable\)$@#\1\ndeb https://mirrors.aliyun.com/termux/game-packages-24 games stable@' $PREFIX/etc/apt/sources.list.d/game.list

sed -i 's@^\(deb.*science stable\)$@#\1\ndeb https://mirrors.aliyun.com/termux/science-packages-24 science stable@' $PREFIX/etc/apt/sources.list.d/science.list

pkg update
  1. 安装需要的包
pkg i nmap openssh -y

nmap: 是一个网络探测工具,用于扫描和分析网络上的主机和服务(别人装了我也装,虽然我没用)
openssh: 是 OpenSSH 工具集的一部分,提供了安全的远程登录、文件传输和隧道服务。(可以用电脑和手机通信,方便在电脑操作)

  1. 设置密码
passwd
  1. 启用 ssh
sshd  //手机上输入后就可以在电脑上用 cmd命令行与手机的termux通信
ifconfig //可以查看手机的IP地址(建议在路由后台将手机IP固定)

电脑端 cmd 输入
ssh [手机ip] -p 8022

  1. 授权文件访问权限
termux-setup-storage // 这命令会在手机上提示你是否允许文件访问,
                     //完成授权后,在$HOME目录会多出一个storage目录,
                     //这个目录是可以和后面安装的 ubuntu 进行数据共享的

搞定这些基本上可以快乐的玩耍了