[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can not delete file with correct permissions



On Thu, May 06, 2021 at 12:52:22PM -0400, Greg Wooledge wrote:
> On Thu, May 06, 2021 at 06:04:31PM +0200, tomas@tuxteam.de wrote:
> > OK. The problem is you have some directory where users are
> > supposed to be able to create a file, but to only remove
> > *their* files, but not other's.
> > 
> > This is a well-known problem (/tmp also has that problem), and
> > UNIX-like file systems have something for that. This is called
> > the "sticky bit" [1].
> > 
> > And lo and behold, *my* /var/mail has this sticky bit:
> > 
> >  | tomas@trotzki:~$ ls -al /var/mail
> >  | total 220
> >  | drwxrwsr-x  2 root  mail   4096 Feb 25 15:30 .
> >          ^ Here it is
> 
> Incorrect.  That's the setgid bit.

Yikes :)

> unicorn:~$ ls -ld /var/mail /tmp
> drwxrwxrwt 16 root root 12288 May  6 12:39 /tmp/
> drwxrwsr-x  2 root mail  4096 Jan 11  2018 /var/mail/
> 
> /tmp has the sticky bit, which is shown as a "t" in the lowest bit
> position.  /var/mail has the setgid bit, shown as an "s" in the group
> execute bit's position.

Ack. You are right. Sorry for that confusion.

The whole thing has rather to do with write access to the directory
(although I'd have expected that to go with a sticky bit anyway).

> MUAs are not expected to DELETE user inbox files.  If you delete all of
> the messages in your inbox, this should simply leave your inbox file
> empty, not deleted.
> 
> There is no need for a user MUA to delete or rename inbox files in
> system-wide /var/mail directories.  There's an argument to be made that
> it might want to *create* one if it doesn't already exist, but it can't,
> so we simply ignore that.  The inbox file will be created by the system
> MTA when the first message is delivered to that user.  At that point,
> the user's MUA can read and write the existing file without problems.

No. What the MUA is trying to do (see my other mails) is to create
and delete lock files. That's why it wants write access to the
mail spool directory.

There is a mode for mutt where it actually uses a setgid helper
program.


Attachment: signature.asc
Description: Digital signature


Reply to: