473,841 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fixing NetInfo Errors on the Command Line

5,821 Recognized Expert Expert


Today, while performing routine maintenance, I noticed that I was no longer able to use sudo. And attempting to authenticate wasn't working; my computer kept complaining that I wasn't providing a valid administrator's Username.

"That's odd," I thought, since I'd always had an administrator account.

A quick trip into Netinfo Manager confirmed my suspicions: One of my groups had been mysteriously renamed to start with 'admin'.

Now, In Mac OS X, the 'admin' group defines the Users that have administrator privileges. And when there's two admin groups, the system gets confused and decides that there should be *no* administrators.

This is not good, especially because you need admin privileges to modify the NetInfo database!

Fortunately, there is hope. By booting into single User mode (hold down Cmd-S right after you hear the startup chime), you can execute commands with root permissions, even if your normal login account does not have admin privileges.

And wouldn't you know it, but there's a fantastic tool for working with your NetInfo database from the command line in Mac OS X. It's called nicl.

nicl is short for 'NetInfo Command Line'. Unfortunately, there's not a whole lot of documentation for it, but we'll go over the basics here.

Warning: You can screw things up pretty badly if you don't know what you're doing. Only modify your NetInfo database to fix problems, not to cause them.


Let's start with some simple stuff. Open up your terminal and type the following command:

Expand|Select|Wrap|Line Numbers
  1. nicl . -list /users
This will output a list of all User account short names on your system. Note the dot after 'nicl'. This means that we want to look at the local NetInfo database. The '-list' argument means that we want to list all nodes in the users 'directory'.

Note that the term 'directory' here does not actually mean a folder in the filesystem; we use the term because it's kind of like a directory because the NetInfo database is organized in a hierarchal fashion similar to your computer's filesystem.

If you wanted to get information about a specific User account, you could run this command:

Expand|Select|Wrap|Line Numbers
  1. nicl . -read /users/daemon
This command lists all variables for the 'daemon' node in the 'users' [pseudo-]directory.

Advanced Stuff

Now let's get into the interesting stuff. How do we change information in the NetInfo database? There are basically four commands that will do the bulk of what you'll need:
  • -create to create nodes (sudo nicl . -create /users/joe)
  • -append to add values to nodes (sudo nicl . -append /users/joe passwd "*")
  • -rename to, well, rename stuff (sudo nicl . -rename /users joe mark)
  • -delete to delete stuff (sudo nicl . -/users mark)

Note that to modify your NetInfo database, you need root permissions. This is where single-User booting comes in handy.

Fixing NetInfo

Considering the situation described at the start of this article, I needed to do something about the errant group entry. After looking at the duplicate 'admin' group (using nicl . -read /groups/admin), I realized that the new group would have to go, and I'd have to re-create the original group (it was www).

So I booted into single-User mode and executed the following commands:
Expand|Select|Wrap|Line Numbers
  1. sh /etc/rc  # finish startup sequence
  2. .
  3. .
  4. .
  5. nicl . -list /groups  # Since there's two admin groups, I don't want to delete the wrong one.
  6. .
  7. .
  8. .
  9. 60         mailman
  10. 61         appserverusr
  11. 62         admin                  <---  Here's the duplicate.  Note its ID number 62.
  12. 63         appserveradm
  13. .
  14. .
  15. .
  16. nicl . -delete 62  # You can also refer to nodes by their ID numbers to resolve duplicates.
  17. nicl . -create /groups/www  # Recreate the original group
  18. nicl . -append /groups/www users www
  19. nicl . -append /groups/www name www
  20. nicl . -append /groups/www passwd "*"
  22. shutdown -r now  # To restart the computer.
Once I logged back in, everything was back to normal!


nicl provides a very handy interface for viewing and modifying your NetInfo database information. You can -list and -read directories and nodes, -create, -rename and -delete directories, nodes and keys and -append keys and values to nodes.

You can use nicl in single-User mode to repair damaged NetInfo databases, even if you would otherwise be unable to use your computer.

For More Information
Check out Apple's man page for nicl for more information on how to use nicl.
For more information about NetInfo, what it does and how it works, check out Apple's man page for netinfo.
Jun 23 '07 #1
0 7420

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Mike Zupan | last post by:
I had some problems with urllib and py2exe under pyton2.3. I works fine until i try to use the exe file. Here is the error Error: 1 LookupError Exception in Tk callback Function: <bound method MainWindow.selectDir of <__main__.MainWindow instance at 0x00DF4058>> (type: <type 'instancemethod'>)
by: ChrisH | last post by:
Is there a way in python to run a DOS command and have it return any errors that occur? I've tried some of the different versions of peopen as well as the code listed below and none of them give me the error that is displayed when I run the command from a prompt. (Python 2.3, win32all, Windows NT/2K/XP) strExec = 'copy "z:\MS Exchange Settings.NK2" "%USERPROFILE%\Application Data\Microsoft \Outlook\"'
by: Wolfgang Kohnen | last post by:
Hello out there! I am new to python and so far I like it a lot. Now I want to create some IMAP mailboxes on my cyrus imapd, with quotas and each user should be subscribed to her/his own spam folder. This is what I've attempted: > >>> import imaplib, getpass > >>> cyrus = imaplib.IMAP4() > >>> cyrus.login("cyrus", getpass.getpass()) > Password:
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a similar name to the table. Rather than making a long Select Case that could become obsolete if lookup tables are added and the source table of the ListBox is edited I came up with this code.) This code works but of course it gives me build...
by: vadi | last post by:
I need to design a class for fixing different kind of errors. The errrors fall into number of categories. For each category the methodology of fixing the error is different. I do not want to use a switch...case statement for handling different category of errors. Can any one suggest me the method?
by: Stephen Cairns | last post by:
I have the following rpx file in a .Net solution and I am getting the following build errors which are driving me crazy and ive no idea where I have went wrong. The build errors I'm getting are as follows: - 'CheckBox' is an ambiguous reference 'CheckBox' is an ambiguous reference 'Label' is an ambiguous reference etc................. Could someone please tell me where I have gone wrong. Here is the rpx.cs file if this helps.
by: wxforecaster | last post by:
As alluded to in my post yesterday, I'm trying to compile a common C utility in Windows. It's only reference is to zlib.h, which needs zconf.h and in turn libz.a On Unix I've compiled this with success by running: gcc -lz -o foo.exe foo.c (where -lz is a link to 'z' or libz.a) I've placed zlib.h and zconf.h in the VC include folder, and libz.a and libz.so in the lib folder.
by: Franky | last post by:
I have a cpp program that use to compile in C++6 but give a bunch of errors in VS2005 I'm wondering if I need to reference to some library. I'd appreciate any helpful suggestion Even if it's just a suggestion of where to look or something that might work.
by: V S Rawat | last post by:
Browser has its own settings, java, javascripts, addons, extensions, keyboard shortcuts, along with the problem in html coding in the php file, which all I think might interfere with seeing only the php part. Is there any interface where I can test/ debug my php code snippets without browser? Any xpsp3/ dos command line or other utility that would at process my php file and least allow me to see the output (final html that would go to...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.