我正在尝试在 EC2 实例上实现 FTP 服务器。我无法启动 FTP 服务器,而且它让我几乎不知道哪里出了问题。如果您能提供任何有关如何解决问题或至少如何调试它的信息,我将不胜感激。
我将使用 S3 存储来接收文件,但是 FTP 尚未触及该内容。
我相信安装顺利。如果出现问题,请告诉我。
谢谢!
尝试启动:
$ sudo chkconfig vsftpd on
Note: Forwarding request to 'systemctl enable vsftpd.service'.
$ sudo service vsftpd start
Redirecting to /bin/systemctl start vsftpd.service
Job for vsftpd.service failed. See 'systemctl status vsftpd.service' and 'journalctl -xn' for details.
那么,告诉我哪里出了问题?没什么问题……
$ systemctl status vsftpd.service
vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled)
Active: failed (Result: exit-code) since Mon 2015-11-16 16:39:41 EST; 8s ago
Process: 2178 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=2)
$ journalctl -xn
No journal files were found.
您有可用的 ftpsecure 吗?
$ cut -d: -f1 /etc/passwd
root
...
ec2-user
ftpsecure
cat /etc/passwd
...
ftpsecure:x:1001:1001::/home/ftpsecure:/sbin/nologin
显示配置文件:
$ sudo cat /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=077
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
chown_uploads=YES
chown_username=ec2-user
xferlog_file=/var/log/xferlog
log_ftp_protocol = YES
xferlog_std_format=NO
nopriv_user=ftpsecure
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
listen_ipv6=NO
pam_service_name=vsftpd
userlist_enable=YES
userlist_file=/etc/vsftpd/user_list
userlist_deny=YES
tcp_wrappers=YES
访问文件的方式如下:
$ ls -ld vsftpd
drwxr-xr-x. 2 root root 102 Nov 16 17:09 vsftpd
$ ls -l *
-rw-r--r--. 1 ftpsecure root 8 Nov 16 16:57 chroot_list
-rw-------. 1 ftpsecure root 125 Mar 7 2014 ftpusers
-rw-------. 1 ftpsecure root 361 Mar 7 2014 user_list
-rw-------. 1 ftpsecure root 5099 Nov 16 17:04 vsftpd.conf
-rwxr--r--. 1 root root 338 Mar 7 2014 vsftpd_conf_migrate.sh
$ ls -ld log
drwxrwxrwx. 8 root root 4096 Nov 16 16:43 log
$ ls -l vsftpd.log
-rw-rw-rw-. 1 ec2-user ec2-user 0 Nov 16 16:43 vsftpd.log
文件访问:
$ sudo touch chroot_list
$ sudo touch ftpusers
$ sudo touch user_list
$ sudo touch vsftpd.conf
$ sudo touch /var/log/vsftpd.log
列出文件
$ cat chroot_list
private
$ sudo cat ftpusers
# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
$ sudo cat user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
$ cat vsftpd.log
$