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

Re: Prevent shutdown with systemctl



On 05/01/16 06:30, Gary Dale wrote:
> Possibly but I note that systemctl is owned by root:root so that typical
> users can't execute it anyway. They get execute rights from the links.

Errm, no they wouldn't.  Not if they were symlinks.  Hardlinks, maybe.

> Systemctl seems to figure out what to do based on the link that calls it
> and the current system policy.

It probably detects this from argv[0], which by convention is always the
name of the file executed.  Since that file is the symbolic link, the
name of that symbolic link is what's passed as the first argument in argv.

Permissions, as it's usually the equivalent of a `stat` rather than a
`lstat` system call, will come from the actual binary, which is
world-executable.  The only thing that stops a user from actually
shutting the machine down is the fact that sysctl does all sorts of
voodoo to figure out who you are first before giving the nod to init.
-- 
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: