[Adduser-devel] Re: [Pkg-shadow-devel] Should userdel remove users crontabs?

Alexander Gattin arg@online.com.ua
Sat, 28 May 2005 11:08:58 +0300


Hi!

On Wed, May 25, 2005 at 06:42:26PM +0200, Tomasz Kłoczko wrote:
> > > For this better will be better hook kind of skeleton script like:
> > > 
> > > for i in /usr/lib/userdel.d/*.sh ; do
> > >         if [ -x $i ]; then
> > >                 . $i
> > >         fi
> > > done
> > > 
> > > and all what is neccessary on user del will done depending on partial 
> > > scripts installed by crond, lpr .. and other packages.
> > 
> > The idea seems interesting. It would immediately draw, for Debian, the
> > question of The Right Place for this userdel.d directory (probably
> > /etc/userdel.d if the policy allows this.
> 
> /etc generaly is for configuration files.
> Subdirectories in /usr/lib are for modules and program extensions (also 
> for scripts) and olso for ohter resources arch dependent (this is why 
> glibconfig.h header file is installed in /usr/lib subdirectory .. not in 
> /usr/include) so as far as I know FHS, LSB specyfications IMO 
> /usr/lib/userdel.d can be Right Place (tm) for this kind resources :)

What about /etc/cron.{hourly|daily|weekly|monthly} and
/etc/init.d ? ;)
They are for _scripts_ too, _not plain config_ files...

Also:
/etc/apm/resume.d
/etc/apm/event.d
/etc/apm/other.d
/etc/apm/scripts.d
/etc/apm/suspend.d
/etc/ppp/ipv6-down.d
/etc/ppp/ipv6-up.d
/etc/ppp/ip-down.d
/etc/ppp/ip-up.d
/etc/cipe/ip-down.d
/etc/cipe/ip-up.d
/etc/emacs/site-start.d (?)
/etc/jed-init.d
/etc/dhcp3/dhclient-enter-hooks.d
/etc/network/if-post-down.d
/etc/network/if-up.d
/etc/network/if-down.d
/etc/network/if-pre-up.d
/etc/network/ip-down.d
/etc/network/ip-up.d
/etc/bash_completion.d

So in my opinion any _hook_ script, as it is also a
configuration file (from some point of view, at
least) and can also be added/removed by a system
administrator, may be placed according to either
rules for config files or modules.
But this should also follow "The Golden Rule Of Least
Surprise". (tm) ;)
So I vote for /etc (just compare `find /etc -name *.d`
with `find /usr/lib -name *.d`).
Better though is to use
  `find /etc -type f -a -perm +0111 | grep "\.d\>"`
  `find /usr/lib -type f -a -perm +0111 | grep "\.d\>"`
or something like that.

Also, we could split distribution-installed hook
scripts and sysadmin-installed ones. Then the former
should go under /usr/lib and latter under /etc, if
I remember correctly.

Please correct me if I'm wrong.

> Also use only /usr/lib/userdel.d/*.sh files as extensions allow put in 
> the same directory for example /usr/lib/userdel.d/userdel_hook script with 
> above content without conflicts with scripts installed by crond, lpd and 
> other packages.

So you propose to differentiate distribution-installed
scripts (i.e. scripts installed by cron, lpr, at and
other packages) by extension?

> Probaly above form of
> this hook will be accaptable also in other
> distribution enviroments (?).

Like RH/FC/ASPLinux, for example?

And please, remember about bug #104392, which is
closely related to what we discuss here and can
probably be resolved by introduction of _all_ of
userdel.d, useradd.d and passwd.d hook directories.

> Bug #104392: [TO CLOSE 20050523] passwd should
> include local customization like adduser/deluser
Citing Robert:
> adduser and deluser allow the admin of a machine to
> customize the operation of these scripts by calling
> /usr/local/sbin/$0.local if it exists.  I use this to
> keep auth information in sync between two machines.
> I need this feature for passwd as well.  I don't want
> to use NIS. :)

-- 
WBR,
xrgtn