Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2008 14:34:04 +0100
From:      "Jeremy Hooks" <jeremyhooks@googlemail.com>
To:        "John Almberg" <jalmberg@identry.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: thorny (for me) permissions problem
Message-ID:  <bf2fbe6d0810070634p4ea1b086j96363e7d308268eb@mail.gmail.com>
In-Reply-To: <0C63914A-E3A3-4FC7-92AD-797F407A5FF7@identry.com>
References:  <0C63914A-E3A3-4FC7-92AD-797F407A5FF7@identry.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>> 4. however, after upload, the file has the ownership A:B (i.e, owned by
A, group B) with permissions -rw-r--r--. So B does not have permission to
delete the file.
       -rw-r--r-- 1 user_a user_b 154879 Oct 7 08:40 data_file.csv

Hi John.

Correct me if I am wrong but permission to delete a file depends on the
users permissions for the containing directory.  If B has write permission
on the directory then B can delete the file.  However you will likely need
to use 'rm -f'.

Regards.

Jeremy.

On Tue, Oct 7, 2008 at 1:54 PM, John Almberg <jalmberg@identry.com> wrote:

> The following permissions problem has me stumped:
>
> 1. User A uploads a file (using ftp) to the server, into a directory called
> 'data' owned by user B. Permissions on directory set to allow this, like
> this:
>        drwxrwxr-x  2 user_b user_b   512 Oct  7 08:40 data
>
> 2. A cron job, run by user B, then processes the file
>
> 3. When the processing is complete, the cron job needs to delete the file
> from the server
>
> 4. however, after upload, the file has the ownership A:B (i.e, owned by A,
> group B) with permissions -rw-r--r--. So B does not have permission to
> delete the file.
>        -rw-r--r-- 1 user_a user_b 154879 Oct 7 08:40 data_file.csv
>
> The ftp user can manually change the permissions on the file to -rw-rw-r--,
> but I do not want to depend on the user remembering to change permissions.
> If he forgets, the cronjob will process the file over and over again. I need
> the server to handle this, so it gets done correctly 100% of the time.
>
> B does not have sufficient permissions to delete the file or change it's
> permissions. The only thing I can think of is to have ANOTHER cron job, run
> by A, run every few minutes to check for the existence of a file, and change
> the permissions so B can delete it. But this smells like a kludge to me.
>
> Is there a correct way to handle this? For instance, is there something I
> can set in A's profile, so when he uploads a file, the group permission is
> set to rw? That would be a nice clean way to do it, but I can't find
> anything like that.
>
> Any help, much appreciated.
>
> -- John
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bf2fbe6d0810070634p4ea1b086j96363e7d308268eb>