安装 vsftpd 在 mkdir /srv/ftp 上给出错误

安装 vsftpd 在 mkdir /srv/ftp 上给出错误

我知道 vsftpd 在 处创建了一个默认目录/srv/ftp/。但是,在此特定服务器上,该目录/srv/不可写。

$ sudo apt-get install vsftpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
  logrotate
The following NEW packages will be installed:
  vsftpd
0 upgraded, 1 newly installed, 0 to remove and 86 not upgraded.
Need to get 0 B/153 kB of archives.
After this operation, 353 kB of additional disk space will be used.
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package vsftpd.
(Reading database ... 39125 files and directories currently installed.)
Preparing to unpack .../vsftpd_3.0.3-8+b1_amd64.deb ...
Unpacking vsftpd (3.0.3-8+b1) ...
Setting up vsftpd (3.0.3-8+b1) ...
mkdir: cannot create directory ‘/srv/ftp’: Permission denied
dpkg: error processing package vsftpd (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (232-25+deb9u1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 vsftpd
E: Sub-process /usr/bin/dpkg returned an error code (1)

正如我尝试的mkdir /srv/ftp那样

mkdir: cannot create directory ‘ftp’: Permission denied

因为 /srv/ 是用来挂载数据磁盘的地方,所以我猜想这就是为什么无法在那里创建文件夹的原因。有没有办法让 vsftpd 的安装使用不同的目录来在其他地方创建 ftp 文件夹?

答案1

Root 没有权限写入 /srv。可能是因为它是 nfs 挂载的文件系统。要更改默认目录,请编辑 /etc/vsftpd/vsftpd.conf 并添加类似以下行的内容:local_root=/opt

相关内容