文章目录
一、现象
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能否连接
