2

Two users:

A1:x:1001:1002::/home/A1:/bin/sh
A2:x:1002:1002::/home/A1:/bin/sh

One group:

A1:x:1002:

FTP server: fresh install ProFTPd OS: fresh install Ubuntu Server 12.04

One folder (/home/A1) that I want to make shared between A1 and A2:

/home/A1: A1:A1 rwxrwxr-x
/home/A1/B1.txt: A1:A1 rw-rw-r--
/home/A2/B2.txt: A1:A1 rw-r--r--

What I want:

  • B1.txt to be modifiable by A1 and A2
  • B1.txt to be modifiable by A1, but not by A2 so A2 could only read it.

When I connect to FTP now, A2 can modify anything and I don't really understand this. If I remove group write permission from /home/A1 (so rwxr-xr-x) A2 cannot modify anything.

What do I do wrong?

1

Uploading a file works by creating a new temporary file and moving it into place, not by overwriting the existing file. This is because if the connection was lost in the middle of overwriting the file, you would be left with an incomplete file.

Uploading a new file, removing an existing file, and uploading a new version of an existing file all require write access to the directory only. The permissions on the existing file if any don't matter. Thus A2 can equally modify B1.txt and B2.txt.

If you need different permissions to update these two files, put them in different directories with different permissions.

If you need the two files to be available in the same directory, make B1.txt a symbolic link to writable-by-A2/B1.txt where writable-by-A2 is a directory where A2 has write permission.

2
  • Is that true for proftpd? i thought it was a bit smarter about handling overwrites than that, which is why it has a separate AllowOverwrite option. I tested this last night - with AllowOverwrite=yes, I could overwrite a file with only file-write permissions. Without Overwrite=off, I needed directory-write perms.
    – cas
    Sep 19 '13 at 0:47
  • @CraigSanders I don't know what Proftpd does. I don't recommend enabling overwrite, because you would end up with a truncated file if the connection dies. Sep 19 '13 at 0:52
0

What error message are you getting?

If the error is "Overwrite permission denied" then you need to enable overwriting in your proftpd.conf - by default, it it disabled.

To do this, add:

AllowOverwrite yes

to either the <Global> section (this will allow overwriting anywhere that file permissions would allow it), or to a <Directory /home/A1> section (this would allow overwriting only in that directory and only if file permissions allowed it).

If this isn't the error messages, please add more details to your question - the error message at least, and preferably a log extract.

2
  • Thanks for your answer! Overwrite is defaultly enabled. I get only "DELE command successfull". If I try to modify it via shell (su - A2) it is the same situation so I can delete/modify it.
    – Thomas
    Sep 18 '13 at 13:06
  • what ftp client are you using? it sounds like it's deleting and then uploading the replacemnt rather then just overwriting. once the file is deleted, you need write perm on the directory to create a new file (incl. upload a file with the same name as a just-deleted file)
    – cas
    Sep 18 '13 at 13:14

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.