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

vsFTPd default uploaded file permissions on Ubuntu not working

· 52CE 我爱测

I have a Server running Ubuntu 12.10 x64 , and the last version of vsFTPd. My user example.com has its home folder set on /var/www/example.com , I created a public_html folder inside and gave 777 permisions to it, and removed the…

问题原文

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

I have a Server running Ubuntu 12.10 x64, and the last version of vsFTPd.

My user example.com has its home folder set on /var/www/example.com,

I created a public_html folder inside and gave 777 permisions to it, and removed the writing permissions of the home user folder. Everything is working well but:

Every file I upload by FTP (using SmartFTP) gets a chmod of 0.

My vsftpd.conf had only one line related:

local_umask=022.

I've tried to change to:

file_open_mode=777
local_umask=002

So my files would get 775 as soon as uploaded.

But only my uploaded folders are getting 775 permissions.

My uploaded files get 1411 permissions

Can someone help me solving that?

已采纳解答

原帖链接 · lucasmx · CC BY-SA 4.0

Got my answer:

As the www-data is the user responsible for the webserver and your normal user is responsible for the ftp server, you need first to make them both members of the same group: the group www-data.

Creating custom User:

useradd –d /var/www/asasd.com -g www-data -m yourusername this way the home directory will be the /var/www/asasd.com and your user will be in the www-data group.

after this, change the user pass by typing passwd.

Then, you need to create a public_html folder inside your yourusername home folder, as the FTP wont be able to write in the root of your home folder, you have to create a subfolder.

Remove write permissions of your yourusername folder chmod a-w /var/www/asasd.com

Then, apply new permissions for the subfolder: chmod -R 775 /var/www/asasd.com/public_html (note you must use 775 chmod because you need group write permissions, not user write permissions, as you want the whole group (ftp and www-data) being able to write) Then, own the folder for the www-data chown -R www-data:www-data /var/www/asasd.com/public_html

That way you must be able to use FTP and have a Webserver working.

Good luck!

Funny this info is so hard to find. Are people not sharing knowledge anymore?

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

资料来源与适用范围

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

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

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