Is there a program on CentOS which will sort my passwd/group etc. files by username or uid/gid? On Suse I can do this with a sysconfig switch and Suseconfig, is there something similar on RH-based systems?
Kai
On Mar 31, 2006, at 11:31 AM, Kai Schaetzl wrote:
Is there a program on CentOS which will sort my passwd/group etc. files by username or uid/gid? On Suse I can do this with a sysconfig switch and Suseconfig, is there something similar on RH-based systems?
Kai
-- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com
e.g. sort -t: +0 /etc/passwd >outfile-byname sort -t: -n +2 /etc/passwd >outfile-byuid ?
for what purpose do you need this?
Tony
Tony Schreiner wrote:
sort -t: +0 /etc/passwd >outfile-byname sort -t: -n +2 /etc/passwd >outfile-byuid
I concur Kai, I use this method as well. Sometimes doing it by hand is a lot faster than a silly GUI app. :)
for what purpose do you need this?
I can't speak for Kai, but here I have ranges of UIDs that are not very manageable via GUI tools (ie 1000 -> 1999 for employees, 2000 -> 2999 for permanent contractors, 3000 -> 3999 for temporary contractors, ranges for services, CVS-only users, and so on and so forth).
Sorting by UID then makes it easy to glance and find the next UID in line to feed to useradd and LDAP.
-te
Tony Schreiner wrote on Fri, 31 Mar 2006 11:39:24 -0500:
sort -t: +0 /etc/passwd >outfile-byname sort -t: -n +2 /etc/passwd >outfile-byuid ?
Ah, great, thanks, Tony! I know some of the old Unix shell commands can do really neat things, but i tend to forget about them, I didn't "grow up" with them. If there hadn't been any feedback I would have resorted to coding this in Perl, much of a waste of time.
for what purpose do you need this?
It helps in comparing between machines. And it helps much when you transfer users from one machine to another. I just snip them out in the relevant files and add them on the other machine. Usually something like all users above uid 10000 or so. If the list isn't sorted it's a bit harder to do that.
Kai
Try the GUI: # system-config-users
HTH Oliver
Kai Schaetzl wrote:
Is there a program on CentOS which will sort my passwd/group etc. files by username or uid/gid? On Suse I can do this with a sysconfig switch and Suseconfig, is there something similar on RH-based systems?
Kai
Oliver Schulze L. wrote on Fri, 31 Mar 2006 18:15:16 -0400:
Try the GUI: # system-config-users
no GUI here ;-)
Kai
On Fri, 2006-03-31 at 18:31 +0200, Kai Schaetzl wrote:
Is there a program on CentOS which will sort my passwd/group etc. files by username or uid/gid? On Suse I can do this with a sysconfig switch and Suseconfig, is there something similar on RH-based systems?
pwck and grpck will do this, too.
-David