Exporting

Joel Griffiths griff at aver-computer.com
Wed Jun 23 08:41:36 PDT 1999


On Wed, 23 Jun 1999, Ivan Kohler wrote:
> On Wed, Jun 23, 1999 at 02:25:34AM -0600, Ben Leibig wrote:
> > I'm trying to export user shell accounts to systems which ALREADY have a
> > password file... I tried it, and freeside overwrote the passwd and shadow
> > files with new ones that only had one entry.
> 
> You could have imported the passwd and shadow files first.
I found the best way to do this is to create an administrative shell service
and package, modify the svc_acct.import so that it only imported the
appropriate the shell accounts (I don't have that many unmoderated users and I
am using realms which don't import correctly with the stock version of
svc_acct.import), and then import the stuff in. This seemed to work well for me.



>  > > What I'd really like to do is change freeside so instead of writing a
whole > > new password file every time it just creates the new entries
necessary, > > copies them to passwd.new on the remote system, and then appends
them to the > > end of the file
> > 
> > cat passwd.new >> passwd
> > 
> > Is this possable?
> 
> With the source, anything is possible.  ;)
Yes, it is! Thanks Ivan..... The source you would be looking for would be in
the /usr/lib/perl5/site_perl/FS/svc_acct.pm (on my RedHat system). Oh, it
appears that Ivan already said this.


> For a transaction (adding a single user), you probably want to add a
> `shellmachine' (as opposed to `shellmachines') configuration file.  See
> htdocs/docs/export.html.  You can then modify the insert method in
> site_perl/svc_acct.pm to do what you want.  You will probably also need to
> edit the replace and delete methods. 
You probably don't really want to get into this. If you import the files first,
especially if they are just normal system accounts, you don't need to worry
about this.

BTW, for RedHat, I had to modify the svc_acct->check as follows:
    if ( $recref->{username} eq 'sync' ) {
      $recref->{shell} = '/bin/sync';
    }
    elsif ( $recref->{username} eq 'shutdown') {
      $recref->{shell} = '/sbin/shutdown';
    }
    elsif ( $recref->{username} eq 'halt') {
      $recref->{shell} = '/bin/halt';
    }
    else {
      my($shell);
      if ( $shell = (grep $_ eq $recref->{shell}, @shells)[0] ) {
        $recref->{shell} = $shell;
      } else {
        return "Illegal shell ". $self->shell;
      }
    }



> MHO is to import first.  The socratic question I'd ask about what you plan
> to do is "How do you prevent duplicate usernames?"
Or duplicate User ID's for that matter.....

BTW, Ivan, I am trying to verify in an additional database table that a
particular user doesn't exist. This database is used to store email aliases and
additional POP boxes for our customers (kinda like AOL allows). I have toyed
with the idea of just writing the aliases to an email only svc_acct that
doesn't write to the password file, but that isn't really how I want to do it.
What I want to do is verify that the information isn't in this secondary table.
I tried to use the qsearchs but it complains that it doesn't recognise the
table name. I'm not much with OO stuff, but I am learning fast. You wouldn't
have any quick hints as to how I would easily go about this, do you. I am sure
I'll figure it out sooner or later, but I figured I would ask since I am here.
:-)


-- Joel Griffiths --
Senior Internet Engineer                  Aver, Inc.
(760) 568-4351 Phone              (760) 341-8694 Fax
"The world won't change just because I complain."
               Martina McBride



More information about the freeside-users mailing list