How to dump the full /etc/passwd and /etc/group files when NIS (YP) or LDAP is used

This blog post explains how to dump the flattened version of /etc/passwd and /etc/group files on a Unix system when some user and group entries are stored in a NIS (YP), LDAP or other server.

To dump these fules, run the following commands (not as root, without the leading $).

$ getent group  >/tmp/group
$ getent passwd >/tmp/passwd

The equivalent commands in Perl (use them if getent(1) doesn't work for you):

$ perl -le'$,=":";while(@_=getgrent){$_[3]=~y@ @,@;print@_}'  >/tmp/group
$ perl -le'$,=":";while(@_=getpwent){print@_[0,1,2,3,6,7,8]}' >/tmp/passwd

For NIS (YP) users and groups only, one can use ypcat passwd and ypcat group, respectively.


How to run Syncless on Linux without installing it?

This blog post explains how to run asynchronous, coroutine-based client and server I/O libraries like Syncless, gevent and Concurrence on Linux without installing them.

On Linux, it's possible to try Syncless without installation, using the StaticPython binary Python distribution, like this:

$ wget -O stacklessco2.7-static \
$ chmod +x stacklessco2.7-static
$ ./stacklessco2.7-static
Python 2.7.1 Stackless 3.1b3 060516 (release27-maint, Feb  1 2011, 16:57:16)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from syncless import coio
>>> coio.sleep(1.5)
(sleeping for 1.5 second)
<object object at 0xf7709490>


  • This solution requires Linux on x86 (i386) or x86_64 (amd64) architecture. If you have a different Unix system, you have to install Syncless the regular way (e.g. with sudo easy_install syncless).
  • This solution doesn't give you the newest version of Syncless.
  • You can't use Python extensions written in C, except for those compiled into stacklessco2.7-static. See the full list on the StaticPython home page.

Please note that StaticPython can run many other I/O frameworks and libraries, which don't require compiling C extensions. Such libraries include Eventlet, Tornado, Twisted, asyncore and circuits.