home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeMac OS X for Unix GeeksSearch this book

3.8. Managing Users and Passwords

The NetInfo equivalent of the passwd file resides under the /users portion of the NetInfo directory. Mac OS X uses /etc/master.passwd for storing encrypted passwords. That master.passwd file is called the shadow password file because it shadows the other, nonsensitive information contained in the /etc/passwd file. Only the root user can read the shadow password file. Nonprivileged users can use the regular passwd file to discover other information, such as a user's full name or home directory.

The /etc/passwd and /etc/master.passwd files are consulted only while the system is in single-user mode, or if the system has been reconfigured to use BSD Configuration Files (see Section 3.3, earlier in this chapter). To add a normal user to your system, you should use System Preferences Figure Accounts. However, if you want to bulk-load NetInfo with many users or create a user while logged in over ssh, you can use nicl or niload.

You can list all users with the nireport utility. Supply the NetInfo domain (., the local domain), the directory (/users), and the properties you want to inspect (uid, name, home, realname, and shell):

% nireport . /users uid name home realname shell
-2      nobody  /dev/null           Unprivileged User       /dev/null
0       root    /var/root           System Administrator    /bin/tcsh
1       daemon  /var/root           System Services         /dev/null
99      unknown /dev/null           Unknown User            /dev/null
70      www     /Library/WebServer  World Wide Web Server   /dev/null

3.8.2. Creating a User with nicl

To create a user with nicl, you'll need to create a directory under /users, and set the uid, gid, shell, realname, and home properties. The following code creates the same user shown in the previous section, Section 3.8.1.

# nicl / -create /users/rothman uid 701
# nicl / -create /users/rothman gid 20
# nicl / -create /users/rothman shell /bin/tcsh
# nicl / -create /users/rothman home /Users/rothman
# nicl / -create /users/rothman realname "Ernest Rothman"
# nicl / -create /users/rothman passwd \*

After you create the user, you should set the password as shown in the previous section.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.