rk3568---ftp无法连接

文章目录

一、现象

PC通过FileZilla连接板端rk3568 文件系统ubuntu22

SFTP可以正常连接,但是FTP无法连接

二、排查

PC到板端网络正常(ping命令测试),并且PC关闭了防火墙

(一)查看板端服务是否在跑

c 复制代码
root@ubuntu22:~# systemctl status vsftpd --no-pager -l
● vsftpd.service - vsftpd FTP server
     Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2026-10-29 09:16:58 CST; 4min 11s ago
    Process: 582 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited, status=0/SUCCESS)
   Main PID: 590 (vsftpd)
      Tasks: 1 (limit: 4606)
     Memory: 1008.0K
        CPU: 107ms
     CGroup: /system.slice/vsftpd.service
             └─590 /usr/sbin/vsftpd /etc/vsftpd.conf

10月 29 09:18:31 buntu22 vsftpd[2155]: pam_listfile(vsftpd:auth): Refused user root for service vsftpd
10月 29 09:18:31 ubuntu22 vsftpd[2155]: pam_unix(vsftpd:auth): user [root] has blank password; authenticated without it
10月 29 09:20:08 ubuntu22 vsftpd[2170]: pam_listfile(vsftpd:auth): Refused user root for service vsftpd
10月 29 09:20:08 ubuntu22 vsftpd[2170]: pam_unix(vsftpd:auth): user [root] has blank password; authenticated without it
10月 29 09:20:37 ubuntu22 vsftpd[2256]: pam_listfile(vsftpd:auth): Refused user root for service vsftpd
10月 29 09:20:37 ubuntu22 vsftpd[2256]: pam_unix(vsftpd:auth): user [root] has blank password; authenticated without it

root@ubuntu22:~# systemctl is-enabled vsftpd
enabled

(二)端口监听是否正常

c 复制代码
root@Oubuntu22:~# ss -lntp | grep -E ':21\b'
LISTEN 0      0                  *:21              *:*    users:(("vsftpd",pid=590,fd=3))   

(三)板端本机自测

c 复制代码
root@ubuntu22:~# curl -v --user root: ftp://127.0.0.1/ --max-time 10
*   Trying 127.0.0.1:21...
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
< 220 (vsFTPd 3.0.5)
> USER root
< 331 Please specify the password.
> PASS 
< 530 Login incorrect.
* Access denied: 530
* Closing connection 0
curl: (67) Access denied: 530

(四)查看vsftpd服务日志

c 复制代码
root@ubuntu22:~# journalctl -u vsftpd -b --no-pager | tail -40
10月 29 09:18:31 ubuntu22 vsftpd[2155]: pam_listfile(vsftpd:auth): Refused user root for service vsftpd
10月 29 09:18:31 ubuntu22 vsftpd[2155]: pam_unix(vsftpd:auth): user [root] has blank password; authenticated without it
10月 29 09:20:08 ubuntu22 vsftpd[2170]: pam_listfile(vsftpd:auth): Refused user root for service vsftpd
10月 29 09:20:08 ubuntu22 vsftpd[2170]: pam_unix(vsftpd:auth): user [root] has blank password; authenticated without it
10月 29 09:20:37 ubuntu22 vsftpd[2256]: pam_listfile(vsftpd:auth): Refused user root for service vsftpd
10月 29 09:20:37 ubuntu22 vsftpd[2256]: pam_unix(vsftpd:auth): user [root] has blank password; authenticated without it

/etc/ftpusers 里的 root 被 pam_listfile 拒绝

查看/etc/ftpusers文件内容

复制代码
# /etc/ftpusers: list of users disallowed FTP access. See ftpusers(5).

root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
nobody

将root删掉

复制代码
root@ubuntu22:~# sed -i '/^root$/d' /etc/ftpusers
root@ubuntu22:~# cat  /etc/ftpusers
# /etc/ftpusers: list of users disallowed FTP access. See ftpusers(5).

daemon
bin
sys
sync
games
man
lp
mail
news
uucp
nobody

再次本机测试

c 复制代码
root@ubuntu22:~# curl -v --user root: ftp://127.0.0.1/ --max-time 10
*   Trying 127.0.0.1:21...
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
< 220 (vsFTPd 3.0.5)
> USER root
< 331 Please specify the password.
> PASS 
< 230 Login successful.
> PWD
< 257 "/root" is the current directory
* Entry path is '/root'
* Request has same path as previous transfer
> EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
< 229 Entering Extended Passive Mode (|||23987|)
*   Trying 127.0.0.1:23987...
* Connecting to 127.0.0.1 (127.0.0.1) port 23987
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
> TYPE A
< 200 Switching to ASCII mode.
> LIST
< 150 Here comes the directory listing.
* Maxdownload = -1
* Remembering we are in dir ""
< 226 Directory send OK.
* Connection #0 to host 127.0.0.1 left intact

测试PC能否连接

相关推荐
自由彩虹2 小时前
靶场通关16--victim1
linux·服务器·网络·安全·web安全·网络安全
叼烟扛炮2 小时前
Linux 学习笔记(三十九):网络基石——TCP/IP 模型与 UDP 实战
linux·运维·网络·笔记·学习·tcp/ip
闲云野鹤在人间2 小时前
头秃修炼手册:StorageClass+StatefulSet+ETCD 全套渡劫笔记
linux·数据库·笔记·云原生·kubernetes·etcd
wuminyu2 小时前
JVM规范学习总结:class执行性能差异
java·linux·c语言·jvm·c++
EVEN-09132 小时前
Linux-线程控制
linux·jvm
刚入门的大一新生2 小时前
Linux-线程控制
linux·运维·服务器
C++ 老炮儿的技术栈2 小时前
Linux 动态库踩坑:明明重新编译了 .so,调用函数返回值却一直不变(libfjrobot.so 版本号异常排查实录)
linux·c语言·网络·c++·visual studio
你看我名字3 小时前
云计算工程师技能树:从 Linux 基础到云平台架构能力
linux·架构·云计算
qq_4017004112 小时前
Linux设备树详解
linux·运维·服务器