18.12.2012 Views

O'Reilly - Practical UNIX & Internet Sec... 7015KB

O'Reilly - Practical UNIX & Internet Sec... 7015KB

O'Reilly - Practical UNIX & Internet Sec... 7015KB

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

[Chapter 4] Users, Groups, and the Superuser<br />

●<br />

printers.<br />

nobody, which is a user that owns no files and is sometimes used as a default user for unprivileged<br />

operations.<br />

Here is an example of an /etc/passwd file containing these system users:<br />

root:zPDeHbougaPpA:0:1:Operator:/:/bin/ksh<br />

nobody:*:60001:60001::/tmp:<br />

agent:*:1:1::/tmp:<br />

daemon:*:1:1::/tmp:<br />

ftp:*:3:3:FTP User:/usr/spool/ftp:<br />

uucp:*:4:4::/usr/spool/uucppublic:/usr/lib/uucp/uucico<br />

news:*:6:6::/usr/spool/news:/bin/csh<br />

Notice that most of these accounts do not have "people names," and that all except root have a password field<br />

of *. This prevents people from logging into these accounts from the <strong>UNIX</strong> login: prompt, as we'll discuss<br />

later.[2]<br />

[2] This does not prevent people from logging in if there are trusted hosts/users on that account;<br />

we'll describe these later in the book.<br />

NOTE: There is nothing magical about these particular account names. All <strong>UNIX</strong> privileges are<br />

determined by the UID (and sometimes the group ID, or GID), and not directly by the account<br />

name. Thus, an account with name root and UID 1005 would have no special privileges, but an<br />

account named mortimer with UID 0 would be a superuser. In general, you should avoid creating<br />

users with a UID of 0 other than root, and you should avoid using the name root for a regular user<br />

account. In this book, we will use the terms "root" and "superuser" interchangeably.<br />

4.1.1 User Identifiers (UIDs)<br />

UIDs are historically unsigned 16-bit integers, which means they can range from 0 to 65535. UIDs between 0<br />

and 9 are typically used for system functions; UIDs for humans usually begin at 20 or 100. Some versions of<br />

<strong>UNIX</strong> are beginning to support 32-bit UIDs. In a few older versions of <strong>UNIX</strong>, UIDs are signed 16-bit integers,<br />

usually ranging from -32768 to 32767.<br />

<strong>UNIX</strong> keeps the mapping between usernames and UIDs in the file /etc/passwd. Each user's UID is stored in the<br />

field after the one containing the user's encrypted password. For example, consider the sample /etc/passwd<br />

entry presented in Chapter 3:<br />

rachel:eH5/.mj7NB3dx:181:100:Rachel Cohen:/u/rachel:/bin/ksh<br />

In this example, Rachel's username is rachel and her UID is 181.<br />

The UID is the actual information that the operating system uses to identify the user; usernames are provided<br />

merely as a convenience for humans. If two users are assigned the same UID, <strong>UNIX</strong> views them as the same<br />

user, even if they have different usernames and passwords. Two users with the same UID can freely read and<br />

delete each other's files and can kill each other's programs. Giving two users the same UID is almost always a<br />

bad idea; we'll discuss a few exceptions in the next section.<br />

file:///C|/Oreilly Unix etc/<strong>O'Reilly</strong> Reference Library/networking/puis/ch04_01.htm (2 of 7) [2002-04-12 10:44:36]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!