Subject: PROPOSAL: id(1) changes
To: None <tech-userlevel@netbsd.org>
From: Tim Rightnour <root@garbled.net>
List: tech-userlevel
Date: 04/01/2001 00:16:03
I would like to make some additions to the id(1) utility, and thought I should
bring them up here before doing so:
First.. the problems I am trying to solve:
1) It's not possible to translate a GID number into a group name reliably,
from the command line, especially in the presence of things like NIS/etc.
2) It's not possible to generate a list of users/groups on the machine (without
writing a C program), because of the possibility of NIS/etc.
The problem I'm having.. is doing things like generate a list of users from a
shell script, that could be later used to select a user to modify/view/etc.
Things like nsswitch.conf make it impossible to reliably predict if the
userlisting in /etc/passwd is the "complete" list.
What I would like to do.. is two things:
1) Extend id(1) so information about groups can be displayed. Currently I can
do something like "id 0" to find out that 0==root, but if I have group "10" I
cannot translate that into "wheel" without grepping /etc/passwd, and that
doesn't work in an NIS or hesoid environment.
2) Provide the ability to do something like "ypcat passwd.byname", using the
password file that the system would see via nsswitch.conf. Basically, the
functionality would be to use getpwent() to iterate over the password and group
databases that the system sees, and dump it in a passwd(5) format.
There are two possible ways I could do this.. perhaps 3..
1) Modify id(1) to do both. Dump the password database and allow it to resolve
GID's.
2) Modify id(1) to resolve GID's with an option (maybe -o, both -G and -g are
taken). Then write a program called "nscat" or "nsdump" to do the
passwd/group/netgroup dumping.
3) rather than modify id in option 2.. create a program called "gid". That
seems hokey to me.
I think I like option 2 the best.. comments?
---
Tim Rightnour <root@garbled.net>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
NetBSD supported hardware database: http://mail-index.netbsd.org/cgi-bin/hw.cgi