Re: adduser without ncurses?

From: Martin P. Hellwig (mhellwig_at_xs4all.nl)
Date: 06/19/04

  • Next message: Martin P. Hellwig: "Re: adduser without ncurses?"
    Date: Sat, 19 Jun 2004 20:31:14 +0200
    
    

    Erica wrote:
    > jpd <read_the_sig@do.not.spam.it> wrote in message news:<1087627046.804891@ente.ipberlin.com>...
    >
    >>["Followup-To:" header set to comp.unix.bsd.freebsd.misc.]
    >>On 2004-06-19, Erica <erica@technodyke.com> wrote:
    >>
    >>>I wrote a script to add a whole bunch of users to a FreeBSD box using
    >>>input from
    >>>a file. However, I need something that works like adduser or useradd
    >>>without ncurses, that is, without prompting for input.
    >>
    >>adduser does not use curses but does prompt for input.
    >>
    >>What about pw(1)?
    >
    >
    > pw works, except that it doesn't allow me to set a password. passwd
    > sets the password, but it prompts for input. Any suggestions?

    I know that the pw command is quite complicated but when I do the
    following on my box:

    % pw useradd -n test -d /home/test -m -s /usr/local/bin/bash -w random

    then I get on my stdout:

    password for 'test' is: Ugym8gbxcV

    But if you like to use prefab passwords, you can do that by storing the
    password in a textfile and using redirectors:

    % pw useradd -n test -d /home/test -m -s /usr/local/bin/bash -h fd <
    passwd4usr_test.txt

    If you dont use the redirector you get (single) prompt for a password.

    It is quite scriptible IMHO, reading man pw is recommend however.

    -- 
    mph
    $ /usr/local/etc/rc.d/bikeshed.sh
    $ Usage, mix UNIX with: {politics|religion|both(=GNU/Linux)}
    

  • Next message: Martin P. Hellwig: "Re: adduser without ncurses?"

    Relevant Pages

    • Re: adduser without ncurses?
      ... >>adduser does not use curses but does prompt for input. ... password in a textfile and using redirectors: ... If you dont use the redirector you get prompt for a password. ...
      (comp.unix.bsd.freebsd.misc)
    • Re: Default Username/Password
      ... But to enter "adduser" command, ... Give these to the computer and when back to the prompt, ... Karl - that won't work, since TTY1 prompts for a username and password. ... Then run the adduser command. ...
      (Ubuntu)
    • Re: Default Username/Password
      ... But to enter "adduser" command, ... I'm blocked at the username screen which i get when i boot the ... Give these to the computer and when back to the prompt, ... Then run the adduser command. ...
      (Ubuntu)
    • Re: Need help with curses
      ... Now my problem is defintely with curses. ... and then a prompt is displayed to get an input from the user. ... The program is running because when I press the 'x' key to terminate ... I'm going to try Solaris 10 today. ...
      (comp.unix.solaris)
    • Re: Interactive session, alternating prompt. readline? curses?
      ... I've used cmd and just found code.Interactive*. ... code, not arbitrary code. ... you can set the prompt attribute. ... I think you may need curses or ncurses or similar... ...
      (comp.lang.python)