I'm new to linux, but I'm learning! I'm running CentOS 6.7 with nginx and I'm trying to get vsftpd to work. I can log in via FTP okay, but when I try to write a file, I get an "553 Could not create file" error.

I'm using the ftp username "ftpuser1" that belongs to the group "nginx".

My html root directory is chown'd to nginx:nginx. If I chown ftp1user1 to the html root directory, then I can write without any issues:

chown -R ftpuser1:nginx /usr/share/nginx/html

But, I need the owner to be nginx:nginx.

The directories are chmod'd to 755. If I chmod them to 775, it'll work as nginx:nginx because ftpuser1 is part of the nginx group. But, I want this to work with the directories chmod'd to 755 for better security, so I need to add the ftpuser1 as an owner.

So, how can I chown nginx:nginx AND ftpuser1:nginx to /usr/share/nginx/html at the same time so that I can write via FTP?


Simply create a new group and add ftpuser1 and nginx to them. Then, use chgrp to change the group of the directory to your new group and chmod to make the directory group writeable.

It should look something like this:

groupadd fooey
gpasswd -a ftpuser1 fooey
gpasswd -a nginx fooey
chgrp -R fooey DIRECTORY
chmod -R 775 DIRECTORY
| improve this answer | |
  • But the thing is, I don't want ALL of the directories past public_html to have to be chmod'd to 775. I'd like to keep them as 755 for security. – Joe Kopali Nov 19 '15 at 2:42
  • @Joe, a file can never ever ever have more than one owner. If you're trying to share a file, use a group. The point of 755 for "better security" is that you don't give a file extra permissions (e.g. group write access) unless you need them. In this case you need them. – Wildcard Nov 19 '15 at 2:51
  • 1
    "I want to let the servants deliver food to the pantry, but it's locked." "Okay, give them copies of the key." "Oh no, I want there to be only one key for better security, and I want to keep that myself, and keep the pantry locked. For better security." Well, if the pantry key will open your jewelry safe, you have a different problem. But it doesn't change the solution to How to Let Servants Into the Pantry. – Wildcard Nov 19 '15 at 2:55
  • @JoeKopali I think you might be misunderstanding what 775 does. 775 makes it so that only the owner or people in the current group (which is now fooey) can write to them. No one else can write to them, only read. So this means that ftpuser1 and nginx can write to the files and no one else, which is what you wanted. – a spaghetto Nov 19 '15 at 3:01
  • In Unix, you cannot have a file that is "co-owned." Instead, you use groups if you want to have multiple people access a file. – a spaghetto Nov 19 '15 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.