Bug 55219 - /sbin/nologin kills "easy" setuid with like 'su - nobody -c "command"
Summary: /sbin/nologin kills "easy" setuid with like 'su - nobody -c "command"
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: setup (Show other bugs)
(Show other bugs)
Version: 7.2
Hardware: i386 Linux
medium
high
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 136921
TreeView+ depends on / blocked
 
Reported: 2001-10-27 12:57 UTC by Pekka Savola
Modified: 2014-03-17 02:23 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-28 06:44:28 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Pekka Savola 2001-10-27 12:57:41 UTC
As 'nobody' was changed to use /sbin/nologin, instead of empty, certain things broke badly.

You can no longer build "cheap" setuid solutions with constructs like:

su - nobody -c "command"

This may break very many local daemon initializations (typically from /etc/rc.d/rc.local), as only this is printed:

This account is currently not available.

Possible courses of action:

1) change nobody's shell to empty, or

2) create a small wrapper binary with c (e.g. /usr/bin/setid or /bin/setid) to perform basically the following (about 10-20 lines):
 * takes arguments and one option
 * first argument is always the userid to change the identity to
 * the rest of the arguments would be stored as a command.
 * the option, if present, could toggle whether the command is run through exec or system (default to exec?).
 * setuid, setgid and initgroups to the specified user
 * exec or system the command

as far as I can see, this could provide a scalable and nice way to get the similar behaviour.  Optionally, it could also take an option for 
additional chroot.  The permissions would be 0750 root.root.

3) ignore the problem

Comment 1 Bill Nottingham 2002-01-25 05:06:57 UTC
Nalin, any opinions?

Comment 2 Daniel Reed 2004-10-25 20:58:19 UTC
It is now the case that "su nobody -c command" (as opposed to "su - nobody -c
command") fails with the same error message. This causes root wrappers, such as
the one used by FreeCiv, to silently fail in X.

I last successfully used FreeCiv's root wrapper within the past month or so, but
I just recently noticed the failure. Changing nobody's shell to /bin/true causes
"su nobody -c command" to silently noop (no error message at all, but "command"
is not executed). Changing nobody's shell to /bin/bash allows "su nobody -
command" (and I can confirm it restores FreeCiv's root wrapper).

Comment 3 Bill Nottingham 2005-01-28 06:44:28 UTC
At this point, I don't think this behavior will be changed; it's been
this way for too many releases. Note that running multiple things as
nobody does not allow protections between them; best practices is to
allocate separate UIDs for each different setuid situation needed.


Note You need to log in before you can comment on or make changes to this bug.