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

How to allow a vsftpd to write to a folder other than default `/files`?

· 52CE 我爱测

I'm new to FTP and I've been following this DigitalOcean tutorial . Everything works great except that a user (at least in FileZilla) cannot write to the root of his /home/user/ftp folder, only /home/user/ftp/files . An attempt t…

问题原文

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

I'm new to FTP and I've been following this DigitalOcean tutorial.

Everything works great except that a user (at least in FileZilla) cannot write to the root of his /home/user/ftp folder, only /home/user/ftp/files. An attempt to create in the root folder results in:

Command: PASV Response: 227 Entering Passive Mode (104,131,29,61,191,224).

Command: STOR asdfa

Response: 553 Could not create file.

Error: Critical file transfer error

I scanned /etc/vsftpd.conf file for the word files but I can't find that config anywhere. I've used FTP before and generally you drop and and the files are right there, without needing to navigate to folders.

Is this a chown problem of some sort in Ubuntu?

Is it possible to just allow a user to write to root and if so, how?

已采纳解答

原帖链接 · Esa Jokinen · CC BY-SA 3.0

Your default /etc/vsftpd.conf doesn't initially include all the possible directives the configuration file supports. The rest can be found from man vsftpd.conf.

Answer to your question can be found in the very tutorial you are following:

FTP is generally more secure when users are restricted to a specific directory. vsftpd accomplishes this with chroot jails. When chroot is enabled for local users, they are restricted to their home directory by default. However, because of the way vsftpd secures the directory, it must not be writable by the user. This is fine for a new user who should only connect via FTP, but an existing user may need to write to their home folder if they also shell access.

In other words, you have created the /home/user/ftp folder to allow vsftp use chroot jails without making the home folder /home/user/ read only to the user. Therefore you are already doing best practices and should not be worried about the error as it is normal and desired behaviour.

It is possible but highly not recommended to disable chroot jail.

If this is only about enchanging the user experience, you could try append directly to /home/user/ftp/files after login by adding/modifying vsftp.conf directives:

user_sub_token=$USER
local_root=/home/$USER/ftp/files

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

资料来源与适用范围

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

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

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