Pure-ftpd 无法启动

在某天突然发现需要FTP服务,那就去启动呗,然而启动还出了错…QAQ

具体错误

1
2
3
4
5
6
7
8
9
ubuntu@ubuntu:~$ sudo service pureftpd status
● pureftpd.service - LSB: Startup script for the pure-ftpd FTP Server
   Loaded: loaded (/etc/init.d/pureftpd; bad; vendor preset: enabled)
   Active: failed (Result: resources) since Sun 2019-09-29 15:29:52 CST; 19h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 17744 ExecStart=/etc/init.d/pureftpd start (code=exited, status=0/SUCCESS)

ubuntu@ubuntu:~$ sudo service pureftpd start
Job for pureftpd.service failed because a configured resource limit was exceeded. See "systemctl status pureftpd.service" and "journalctl -xe" for details.

提示说要用 systemctl status pureftpd.service 查看具体错误

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ubuntu@ubuntu:~$ systemctl status pureftpd.service
● pureftpd.service - LSB: Startup script for the pure-ftpd FTP Server
   Loaded: loaded (/etc/init.d/pureftpd; bad; vendor preset: enabled)
   Active: failed (Result: resources) since Mon 2019-09-30 11:02:24 CST; 6s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 19698 ExecStart=/etc/init.d/pureftpd start (code=exited, status=0/SUCCESS)

Sep 30 11:02:24 ubuntu systemd[1]: Starting LSB: Startup script for the pure-ftpd FTP Server...
Sep 30 11:02:24 ubuntu pure-ftpd[19706]: (?@?) [ERROR] Unable to find the 'ftp' account
Sep 30 11:02:24 ubuntu pure-ftpd[19707]: (?@?) [ERROR] Sorry, but that file doesn't exist: [/usr/local/pureftpd/etc/pure-ftpd.pem]
Sep 30 11:02:24 ubuntu pureftpd[19698]: Starting pure-ftpd:
Sep 30 11:02:24 ubuntu systemd[1]: pureftpd.service: PID file /var/run/pure-ftpd.pid not readable (yet?) after start: No such file or directory
Sep 30 11:02:24 ubuntu systemd[1]: Failed to start LSB: Startup script for the pure-ftpd FTP Server.
Sep 30 11:02:24 ubuntu systemd[1]: pureftpd.service: Unit entered failed state.
Sep 30 11:02:24 ubuntu systemd[1]: pureftpd.service: Failed with result 'resources'.

主要错误是两个Error

  • [ERROR] Unable to find the ‘ftp’ account
  • [ERROR] Sorry, but that file doesn’t exist: [/usr/local/pureftpd/etc/pure-ftpd.pem]

解决第一个Error

第一个是没有找到ftp这个账号,那这个比较简单,那就添加ftp账号呗

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
ubuntu@ubuntu:~$ sudo adduser --system ftp
Adding system user `ftp' (UID 113) ...
Adding new user `ftp' (UID 113) with group `nogroup' ...
Creating home directory `/home/ftp' ...
ubuntu@ubuntu:~$ sudo service pureftpd start
Job for pureftpd.service failed because a configured resource limit was exceeded. See "systemctl status pureftpd.service" and "journalctl -xe" for details.
ubuntu@ubuntu:~$ systemctl status pureftpd.service
● pureftpd.service - LSB: Startup script for the pure-ftpd FTP Server
   Loaded: loaded (/etc/init.d/pureftpd; bad; vendor preset: enabled)
   Active: failed (Result: resources) since Mon 2019-09-30 11:04:17 CST; 1s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 19896 ExecStart=/etc/init.d/pureftpd start (code=exited, status=0/SUCCESS)

Sep 30 11:04:17 ubuntu systemd[1]: Starting LSB: Startup script for the pure-ftpd FTP Server...
Sep 30 11:04:17 ubuntu pureftpd[19896]: Starting pure-ftpd:
Sep 30 11:04:17 ubuntu systemd[1]: pureftpd.service: PID file /var/run/pure-ftpd.pid not readable (yet?) after start: No such file or directory
Sep 30 11:04:17 ubuntu pure-ftpd[19905]: (?@?) [ERROR] Sorry, but that file doesn't exist: [/usr/local/pureftpd/etc/pure-ftpd.pem]
Sep 30 11:04:17 ubuntu systemd[1]: pureftpd.service: Daemon never wrote its PID file. Failing.
Sep 30 11:04:17 ubuntu systemd[1]: Failed to start LSB: Startup script for the pure-ftpd FTP Server.
Sep 30 11:04:17 ubuntu systemd[1]: pureftpd.service: Unit entered failed state.
Sep 30 11:04:17 ubuntu systemd[1]: pureftpd.service: Failed with result 'resources'.

解决第二个Error

OK, 那第一个问题就解决了,接下来是第二个问题 提示是找不到 [/usr/local/pureftpd/etc/pure-ftpd.pem] 文件 .pem是证书文件,FTP设置里可能开启了TLS(传输层安全协议),所以需要证书文件,那这个我可以设置不使用TLS就可以了。

那么打开配置文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
ubuntu@ubuntu:$ sudo vim /usr/local/pureftpd/etc/pure-ftpd.conf

// 大约在423行 如果不设置 TLS 那就将 TLS 设置为0,如果想设置TLS,则将证书放到下面配置的指定路径就可以了
// 我这里设为0,保存!
// PS: pem 文件需要 key + crt/cer 文件合成

# This option can accept three values :
# 0 : disable SSL/TLS encryption layer (default).
# 1 : accept both traditional and encrypted sessions.
# 2 : refuse connections that don't use SSL/TLS security mechanisms,
#     including anonymous sessions.
# Do _not_ uncomment this blindly. Be sure that :
# 1) Your server has been compiled with SSL/TLS support (--with-tls),
# 2) A valid certificate is in place,
# 3) Only compatible clients will log in.

TLS                        0
TLSCipherSuite             HIGH:MEDIUM:+TLSv1:!SSLv2:!SSLv3
CertFile                   /usr/local/pureftpd/etc/pure-ftpd.pem

启动!成功解决!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
ubuntu@ubuntu:/usr/local/pureftpd/etc$ sudo service pureftpd start
ubuntu@ubuntu:/usr/local/pureftpd/etc$ systemctl status pureftpd.service
● pureftpd.service - LSB: Startup script for the pure-ftpd FTP Server
   Loaded: loaded (/etc/init.d/pureftpd; bad; vendor preset: enabled)
   Active: active (running) since Mon 2019-09-30 11:08:35 CST; 4s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 20138 ExecStart=/etc/init.d/pureftpd start (code=exited, status=0/SUCCESS)
 Main PID: 20148 (pure-ftpd)
    Tasks: 1
   Memory: 488.0K
      CPU: 10ms
   CGroup: /system.slice/pureftpd.service
           └─20148 /usr/local/pureftpd/sbin/pure-ftpd /usr/local/pureftpd/etc/pure-ftpd.conf

Sep 30 11:08:35 ubuntu systemd[1]: Starting LSB: Startup script for the pure-ftpd FTP Server...
Sep 30 11:08:35 ubuntu pureftpd[20138]: Starting pure-ftpd:
Sep 30 11:08:35 ubuntu systemd[1]: pureftpd.service: PID file /var/run/pure-ftpd.pid not readable (yet?) after start: No such file or directory
Sep 30 11:08:35 ubuntu systemd[1]: Started LSB: Startup script for the pure-ftpd FTP Server.
正在加载 Disqus 评论,你可能需要科学上网才能正常加载Disqus.
lamu
隐藏