大网数据广告活动
服务器运维问答

Trying to Set up Web Server in CentOS on HyperV - FTP Not Working

· 52CE 我爱测

Background I am not a Linux or really even a command line person, but I've been tasked with setting up a Linux server for a company intranet. I've set up a CentOS 7 installation in HyperV on Windows 10. I then got the AMP stack s…

问题原文

原帖链接 · Kelderic · CC BY-SA 3.0

Background

I am not a Linux or really even a command line person, but I've been tasked with setting up a Linux server for a company intranet.

I've set up a CentOS 7 installation in HyperV on Windows 10. I then got the AMP stack set up inside, and I got internet from the network passing through Win10 into CentOS. And I got the CentOS web server have it's own IP address and be accessible from the outside network.

I am now trying to get FTP working, so that when I move the VM to it's eventual real server, which isn't on my desktop, I can move files to it via FTP. I have followed numerous tutorials centered on vsftp. I have installed it, I have added FTP access to firewall-cmd. I have messed with iptables, and then found out that apparently CentOS uses firewalld, not iptables?

Settings

In /etc/vsftp/vsftp.conf:

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
chroot_local_user=YES
allow_writeable_chroot=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.userlist

The contents of /etc/vsftpd.userlist:

tester

Status of vsftpd:

Problem

When I try to connect via FTP, I see:

Question

What am I doing wrong?

已采纳解答

原帖链接 · Adam V · CC BY-SA 3.0

Given the fact that your FTP client there is showing "Connection refused", I believe that your firewall is configured properly but vsftpd simply isn't listening on the address you're attempting to connect to (192.168.15.101). That message happens when the service is either not running on the destination server, or isn't listening on the address you're attempting to connect to. As seen on my test server in both such situations:

[root@host ~]# telnet 192.168.122.173 21
Trying 192.168.122.173...
telnet: connect to address 192.168.122.173: Connection refused

If it were a firewall issue, your error message would be "no route to host" instead:

[root@host ~]# telnet 192.168.122.173 21
Trying 192.168.122.173...
telnet: connect to address 192.168.122.173: No route to host

A few things I would confirm:

  • Is vsftpd listening on that address? If you see the following, then it should be listening on all available IPv4 and IPv6 addresses - if you see something else, then that might be your problem:

    [root@ftpsrv ~]# ss -pln|grep -i ftp
    tcp    LISTEN     0      32       -->:::21<--                   :::*                   users:(("vsftpd",pid=1636,fd=3))
    
  • Is the address you're connecting to the same server that vsftpd is on? ip ad will tell you - never hurts to double-check. You can also try telnetting to vsftpd from the server it's running on just to make sure it's working locally.

SFTP is another option as @Sven mentioned, though that doesn't use vsftpd, but rather your OpenSSH server. It's actually enabled by default in many systems - just check your /etc/ssh/sshd_config file for something like:

Subsystem       sftp    /usr/libexec/openssh/sftp-server

man 8 sftp-server can give you more information about that.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-01-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。