in reply to expect and adduser

$ useradd --help useradd: invalid option -- - usage: useradd [-u uid [-o]] [-g group] [-G group,...] [-d home] [-s shell] [-c comment] [-m [-k template]] [-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] +name useradd -D [-g group] [-b base] [-s shell] [-f inactive] [-e expire ]
Note the -p option. (Yes, I am aware of the theoretical risks -- if that worries you, umount /proc).
Perl --((8:>*

Replies are listed 'Best First'.
Re^2: expect and adduser
by marvell (Pilgrim) on Oct 14, 2005 at 11:33 UTC

    I have to use adduser becuase of the --firstuid option

    --
    Steve Marvell

      But that's just a math problem. Long before we had all these fancy interactive user adding gadgets, I was writing automated tools to add users (with no interaction) in Perl version 3(!).

      I find it odd that you're trying to take a tool that was meant to be more handholding and interactive and make it less interactive. {grin}

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

      On my system, adduser is just a symlink to useradd. And it doesn't have a firstuid option. However, if no uid is supplied on the command line, it picks the first available uid above 99, and above any other user.

      If I were to write such a tool (and I've done so in the past), I'd just open /etc/passwd and /etc/shadow for append (if needed /etc/group as well) and write the necessary lines. But that's just me. Or I use useradd/adduser to setup everything, but the password, and require the user to visit my office and type in his/her password.

      Perl --((8:>*