Bug 76612 - "-w /etc/passwd" is not a good test for priviledged user
"-w /etc/passwd" is not a good test for priviledged user
Product: Red Hat Linux
Classification: Retired
Component: portmap (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
Jay Turner
Depends On:
  Show dependency treegraph
Reported: 2002-10-24 00:43 EDT by Aleksey Nogin
Modified: 2015-01-07 19:01 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-01-06 15:32:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Aleksey Nogin 2002-10-24 00:43:25 EDT
Currently /etc/rc.d/init.d/portmap uses

# Check that we're a priviledged user
[ -w /etc/passwd ] || exit 0

This is not the best way of checking for permissions. For example, if the
/etc/passwd happens to be on an r/o fs at the moment (as I have in my setup),
the test will fail even if the script is running as root, as there is no real
reason to abort - after all, the script does not really need any write access to
/etc/passwd! And it's possible to use other means of authenticating (yp, db,
etc) and not even have a /etc/passwd file!

The test

# Check that we're a priviledged user
[ `id -u` -ne 0 ] && exit 1

that identd uses seems more appropriate.
Comment 1 Aleksey Nogin 2002-10-27 21:40:35 EST
P.S. xinetd also uses the same "-w /etc/passwd" test.
Comment 2 Aleksey Nogin 2003-01-05 02:06:07 EST
This seems to be fixed in Phoebe.

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