【问题标题】:Can not connect vsftpd remotely?无法远程连接vsftpd?
【发布时间】:2015-12-16 21:08:21
【问题描述】:

我有一个带有 raspberryPi 和 Windows 计算机的家庭网络。我想通过 FTP 在这两者之间共享文件。所以我已经在我的树莓派上下载、安装和配置了 VSFTPD。现在我可以从 rasPi 本地连接此服务器,但不能从我的 Windows PC 连接。

您可以在下面找到更多信息、命令输出、conf 文件等。

****树莓派****

vsftd.conf

listen=YES
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
user_sub_token=$USER
local_root=/home/$USER/ftp

sudo 服务 --status-all

> sudo service --status-all
[ + ]  vsftpd

nmap 本地主机

> nmap localhost
Starting Nmap 6.00 ( http://nmap.org ) at 2015-12-16 22:55 EET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.029s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 996 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
80/tcp   open  http
5002/tcp open  rfe
Nmap done: 1 IP address (1 host up) scanned in 4.80 seconds

ftp 本地主机

> ftp localhost
Connected to localhost.
220 (vsFTPd 2.3.5)
Name (localhost:pi): pi
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

****Windows****

ping 192.168.2.140

> ping 192.168.2.140
Pinging 192.168.2.140 with 32 bytes of data:
Reply from 192.168.2.140: bytes=32 time=1ms TTL=64
Reply from 192.168.2.140: bytes=32 time<1ms TTL=64
Reply from 192.168.2.140: bytes=32 time<1ms TTL=64
Reply from 192.168.2.140: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.2.140:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

ftp 192.168.2.140

> ftp 192.168.2.140
ftp: connect :Connection timed out

感谢您的帮助。

【问题讨论】:

标签: ftp raspberry-pi raspbian ftp-server vsftpd


【解决方案1】:

您可以在本地连接但不能远程连接的一个可能原因是由于哪个用户 VSFTPD 正在访问本地用户帐户。是 ROOT 还是您登录的 USER ID。

在查看您的设置时,我注意到您有:

chroot_local_user=YES
write_enable=YES
local_root=/home/$USER/ftp

我还要补充:

allow_writeable_chroot=YES
seccomp_sandbox=NO

我会执行:

setsebool -P ftp_home_dir on

如果这个建议失败了,我也在 Ask Fedora 论坛中问了一个类似的问题。 Link to Question。在这个问题中,我发布了几个讨论设置 VSFTPD 的文章的链接。也许其中之一会提示您要寻找什么。

他们的一些建议是:

allow a global user for VSFTPD full file system access 

这是一个非常危险的选项,它破坏了许多 VSFTPd 试图帮助保护您免受攻击的安全协议。

change the read write privileges on /home/$users to a-w

如果您添加“allow_writeable_chroot=YES”并将 SELinux ftp_home_dir 设置为 ON,则不需要此更改。

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-28
    • 2016-05-21
    • 1970-01-01
    • 2015-08-28
    • 2018-11-12
    • 2016-06-29
    • 2017-07-19
    • 2015-01-03
    相关资源
    最近更新 更多