- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Tell Us What You Think!
- Introduction
- Part I: Introduction to Mac OS X
- Chapter 1. Mac OS X Component Architecture
- Chapter 2. Installing Mac OS X
- Chapter 3. Mac OS X Basics
- Chapter 4. The Finder: Working with Files and Applications
- Chapter 5. Running Classic Mac OS Applications
- Part II: Inside Mac OS X
- Chapter 6. Native Utilities and Applications
- Chapter 7. Internet Communications
- Chapter 8. Installing Third-Party Applications
- Part III: User-Level OS X Configuration
- Chapter 9. Network Setup
- Chapter 10. Printer and Font Management
- Chapter 11. Additional System Components
- Part IV: Introduction to BSD Applications
- Chapter 12. Introducing the BSD Subsystem
- Chapter 13. Common Unix Shell Commands: File Operations
- Part V: Advanced Command-Line Concepts
- Chapter 14. Advanced Shell Concepts and Commands
- Chapter 15. Command-Line Applications and Application Suites
- Chapter 16. Command-Line Software Installation
- Chapter 17. Troubleshooting Software Installs, and Compiling and Debugging Manually
- Chapter 18. Advanced Unix Shell Use: Configuration and Programming (Shell Scripting)
- Part VI: Server/Network Administration
- Chapter 19. X Window System Applications
- Chapter 20. Command-Line Configuration and Administration
- Chapter 21. AppleScript
- Chapter 22. Perl Scripting and SQL Connectivity
- Chapter 23. File and Resource Sharing with NetInfo
- Getting to Know the NetInfo Database
- Using the NetInfo Database to Customize a User
- Using the NetInfo Database to Share Resources
- Restoring the Local NetInfo Database
- Summary
- Chapter 24. User Management and Machine Clustering
- Chapter 25. FTP Serving
- Chapter 26. Remote Access and Administration
- Chapter 27. Web Serving
- Part VII: Server Health
- Chapter 28. Web Programming
- Chapter 29. Creating a Mail Server
- Chapter 30. Accessing and Serving a Windows Network
- Chapter 31. Server Security and Advanced Network Configuration
- Chapter 32. System Maintenance
- Appendix A. Command-Line Reference
- Appendix B. Administration Reference
Using the NetInfo Database to Customize a User
Now that you have had the opportunity to examine the NetInfo database, back it up, and try using it. In the previous section, you saw that changes can be made in the NetInfo database in conjunction with other tools. We will make use of that idea in this section, where we will learn how to customize the creation of a user account. We will use the Users control panel to create a user, but we will customize our user by editing information in the NetInfo database.
In our example, we will make a user that we want to use as our general software user. This is a specialized user whose account we want to use when compiling software for the system, but we do not want to be one of the administrators for the machine. We would like our user to belong to a group called tire, with group ID 100. We would also like to have a specific user ID, 502, for our user, whose account we intend to call software. To create this user, do the following:
-
Open the Users control pane in the System Preferences. Click the lock icon if it is set to not allow changes. Next enter the administrator username and password; then click New User, as shown in Figure 23.20.
Figure 23.20 The Users control pane is where you create users.
-
A New User window appears, as seen in Figure 23.21. Enter the following information for the user:
- Name— Enter a name for your user.
- Short Name— The short name is the username, that is, the name of the account. This is the name that the user uses to log in to the machine. In our case, the username is software.
- Password— The password should be at least four characters. Many systems recommend at least six characters, with a variety of character types included in the password.
- Verify— Re-enter the password for verification purposes.
- Password Hint— This is an optional field. If you include a hint, make sure that the hint is not so obvious that other users can guess the password.
Figure 23.21 A New Users window appears where a name, username, and password are entered for the new user. A box can be checked to allow a user administrative privileges.
- Do not check the box enabling administrative privileges. Click Save.
- You are returned to the Users control pane, which now lists your new user by name. If you were not interested in customizing your user, you would be done. However, to customize the user, the NetInfo database must be edited. Make a back up of the NetInfo database, if you do not already have a recent backup. Open the NetInfo Manager, and select the local domain if it is not already selected. Click the lock to make changes, and enter the administrator username and password.
-
Click the groups directory and scroll through the list. Because tire is not a default group that comes with the system, you should not see a group called tire. So, you will have to make a new group. Click any group to see what values are typically included in a group. Figure 23.22 shows the types of properties that belong to a group.
Figure 23.22 Looking at the staff directory, we see that the typical properties for a group are passwd, name, gid, and users.
-
Click groups. Under the Directory menu, select New Subdirectory. A new directory called new_directory appears. Edit the name property and add properties as follows:
The * in the password field means that a group password is not being assigned. So far, we have only one user in our group, user software. As the term group implies, we can have more than one user in a group.Property Value name tire passwd * gid 100 users software -
Select Save under the Domain menu. The question to Confirm Modification appears. Click Update this copy. Now new_directory has become tire, as shown in Figure 23.23.
Figure 23.23 We now have a new group called tire, with GID 100. At this time, only one user, software, belongs to the group.
-
Click users, and then click software. Now the default information on user software appears in the bottom window. If this is one of your first users, 502 might already be the user ID. A group ID of 20 is probably what was made. If you look at the information on software, you can see that the Users pane added quite a bit of information about software to the NetInfo database. The password you see is an encrypted version of the password.
Because software was not one of our first users, we have to either change the user ID of our original user or delete it. Because our original user with UID 502 was simply a demonstration user to run various commands, we chose to delete it. If we had wanted to keep our user, we could have changed the user ID of the original user to one that was not already taken, and then changed the UID of software to 502. For your purposes, the user ID for software might not be important. Because we would like to share some of our resources with another machine that also has a user called software, whose UID is 502, it is important for us to make software's UID 502 for compatibility purposes. In either case, we want user software to belong to group tire. Change the GID to 100. Change the UID as is appropriate for your situation. Select Save under the Domain menu, and click Update this copy in the Confirm Modification box. Figure 23.24 shows the updated information for our user software.
Figure 23.24 Now our user software has UID 502 and GID 100. We can see from this information that user software has been assigned a password, a home directory in /Users/software, and a default shell of /bin/tcsh.
- Under the Options menu, select Restart All NetInfo Domains on Local Host. An alert asking if you really want to restart the machine's NetInfo servers appears. Click Yes. Click the lock to prevent further changes.
-
Open a terminal window, go to software's home directory, and look at the directory's contents. Take note that the directory was created by the Users pane with the default values. The update to the information in the NetInfo database, however, was not entirely reflected in the system. So, you will have to manually implement those changes. First, here is the default information for the software user that was created on our system:
[localhost:~software] joray% ls -al total 8 drwxr-xr-x 11 505 staff 330 Jan 30 18:17 . drwxr-xr-x 8 root wheel 228 May 4 13:45 .. -rw-r--r-- 1 505 staff 3 Nov 14 13:39 .CFUserTextEncoding drwx------ 3 505 staff 264 Feb 20 12:29 Desktop drwx------ 2 505 staff 264 Nov 14 16:45 Documents drwx------ 15 505 staff 466 Feb 2 19:40 Library drwx------ 2 505 staff 264 Nov 15 17:14 Movies drwx------ 2 505 staff 264 Nov 15 17:14 Music drwx------ 2 505 staff 264 Nov 15 17:14 Pictures drwxr-xr-x 3 505 staff 264 Nov 15 17:09 Public drwxr-xr-x 4 505 staff 264 Feb 13 19:31 Sites
In our example, software's original UID was 505. If you did not change your software user's UID, you should see software in that column, not 505. The default GID that the Users pane used for creating software was GID 20, which is the staff group on OS X. So, the information that we see for software's home directory is the information that was originally assigned to software. We have to update the information to software's directory to reflect the new information.
As root, in the /Users directory, change the ownership of software's directory to the software user in group tire:
[localhost:/Users] root# chown -R software.tire software
Check the results:
[localhost:/Users] root# ls -ld software
drwxr-xr-x 11 software tire 330 Jan 30 18:17 software
[localhost:/Users] root# ls -l software
total 8
-rw-r--r-- 1 software tire 3 Nov 14 13:39 .CFUserTextEncoding
drwx------ 3 software tire 58 Feb 20 12:29 Desktop
drwx------ 2 software tire 24 Nov 14 16:45 Documents
drwx------ 15 software tire 466 Feb 2 19:40 Library
drwx------ 2 software tire 24 Nov 15 17:14 Movies
drwx------ 2 software tire 24 Nov 15 17:14 Music
drwx------ 2 software tire 24 Nov 15 17:14 Pictures
drwxr-xr-x 3 software tire 58 Nov 15 17:09 Public
drwxr-xr-x 4 software tire 92 Feb 13 19:31 Sites
If you had changed the UID of a user who was originally assigned UID 502, look at that user's home directory and make appropriate ownership changes.
Using the NetInfo Database to Share Resources | Next Section

Account Sign In
View your cart