[nmglug] Group file altered

Gary Sandine gars at laclinux.com
Fri Jul 13 14:32:02 PDT 2007


On Fri, Jul 13, 2007 at 01:46:56PM -0600, Sam Noble wrote:
> On Thu, 2007-07-12 at 11:43 -0600, Tom Rushton wrote:
> > somehow managed to overwrite  the  /etc/group 
> > and  group-  files 
> 
> I'm not familiar with group-, do you mean group~ ? (Which, would be a
> text-editor's backup file of group.)
> 
> Either way, /etc/group is the important file here. Maybe it will help to
> have a copy of a working group file from another Feisty Fawn (latest
> Ubuntu) box.
> 
> This one comes courtesy of Mr. Schaefer (we tried to send this last
> night from the glug after-party but the beer got in the way.):

Careful here.  For example:

> dhcp:x:101:
> syslog:x:102:
> klog:x:103:
> crontab:x:104:
> ssh:x:105:
> lpadmin:x:106:tom

and here's from one i386 Feisty box:

dhcp:x:115:
syslog:x:105:
klog:x:106:
crontab:x:101:
ssh:x:121:
lpadmin:x:107:

and here's from another:

dhcp:x:101:
syslog:x:102:
klog:x:103:
crontab:x:106:
ssh:x:107:
lpadmin:x:104:

Unless dpkg saves the group numbers that were dynamically created
during package installations (* my guess at why they vary so
much;  saves them somewhere other than /etc/group I mean), your
system has a serious problem.

Out of curiosity, wondering why ssh might be different in different
systems, I had a look at:

/var/lib/dpkg/info/openssh-client.postinst

and found that it used addgroup to create the ssh group without
specifying a numeric gid (* guess confirmed).

One way you can probably fix this is to grep for addgroup and related
items in /var/lib/dpkg/info/*.{preinst,postinst} and then look for
files that were chgrp'd by a postinst script.  For example,
/usr/bin/ssh-agent was chgrp'd to group ssh by the
/openssh-client.postinst script.  "ls -ln" that file and you will see
the number of the group that should be ssh, then do sudo vigr (or
"sed -i") and make it so.

I bet someone can make a one line bash script to do this. ;)




More information about the nmglug mailing list