termux使用ftp

termux使用ftp

一键实现脚本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 先安装依赖
pkg install -y busybox termux-services

# 通过下面命令更新会话或重新打开termux
source $PREFIX/etc/profile.d/start-services.sh

cat - >> ~/.bashrc <<'EOF'
alias ftpd="exec busybox tcpsvd -vE 0.0.0.0 8021 busybox ftpd -w"
alias kftpd='ps aux | grep -v grep | grep -E "busybox|ftpd" | awk '\''{print $2}'\'' | xargs kill -9'
EOF
source ~/.bashrc

# # 使用示例:
# # 映射当前路径
# ftpd
# # 或,映射指定路径
# ftpd ~/temp

正文

一键安装脚本

1
2
3
4
5
# 先安装依赖
pkg install -y busybox termux-services

# 通过下面命令更新会话或重新打开termux
source $PREFIX/etc/profile.d/start-services.sh

ftpd参考

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 可以使用 MT管理器/ES文件浏览器 通过 8021 端口连接到ftp服务

# 可以在 $PREFIX/var/service/ftpd/run 看到使用的命令,其中 -w 表示允许读写,不带则只读
busybox ftpd
<<'CONTENT'
BusyBox v1.37.0 (2025-12-06 14:22:18 UTC) multi-call binary.

Usage: ftpd [-wvS] [-t SEC] [-T SEC] [DIR]

Anonymous FTP server. Client access occurs under ftpd's UID.
Chroots to DIR, if this fails (run by non-root), cds to it.
It is an inetd service, inetd.conf line:
        21 stream tcp nowait root ftpd ftpd /files/to/serve
Can be run from tcpsvd:
        tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve

        -w      Allow upload
        -v      Log errors to stderr. -vv: verbose log
        -S      Log errors to syslog. -SS: verbose log
        -t,-T N Idle and absolute timeout
CONTENT
# 使用示例:
exec busybox tcpsvd -vE 0.0.0.0 8021 busybox ftpd -w $HOME

# 启动服务
sv-enable ftpd
sv up ftpd

# 停止服务
sv-disable ftpd
sv down ftpd

使用示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cat - >> ~/.bashrc <<'EOF'
alias ftpd="exec busybox tcpsvd -vE 0.0.0.0 8021 busybox ftpd -w"
alias kftpd='ps aux | grep -v grep | grep -E "busybox|ftpd" | awk '\''{print $2}'\'' | xargs kill -9'
EOF
source ~/.bashrc

# 映射当前路径
ftpd
# 或,映射指定路径
ftpd ~/temp
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计