Recipe 9.4 Finding Superuser Accounts

9.4.1 Problem

You want to list all accounts with superuser access.

9.4.2 Solution

$ awk -F: '$3 == 0 { print $1, "is a superuser!" }' /etc/passwd

9.4.3 Discussion

A superuser, by definition, has a numerical user ID of zero. Be sure your system has only one superuser account: root. Multiple superuser accounts are a very bad idea because they are harder to control and track. (See Chapter 5 for better ways to share root privileges.)

Numerical user IDs are stored in the third field of each entry in the passwd database. The username is stored in the first field. Fields are separated by colons.

9.4.4 See Also

passwd(5).



Linux Security Cookbook
Linux Security Cookbook
ISBN: 0596003919
EAN: 2147483647
Year: 2006
Pages: 247

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net