Re: adduser without ncurses?

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


Date: Sat, 19 Jun 2004 21:08:00 +0200

Martin P. Hellwig wrote:
> 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

BTW
To add a user directly from the command prompt without using a
passwordfile or being prompt for password but using a predefined
password use something like this:

% echo "thisisthepass4test" | pw useradd -n test -d /home/test -m -s
/usr/local/bin/bash -h fd

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


Relevant Pages

  • Re: adduser without ncurses?
    ... > Erica wrote: ... To add a user directly from the command prompt without using a ... passwordfile or being prompt for password but using a predefined ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Shutdown in 5 seconds - unable to get to command prompt
    ... This is in regard to a notebook computer running ... > seconds - not enough time to get to a command prompt. ... The solution, in her case, was to insert the last OEM restore CD in the ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Shutdown in 5 seconds - unable to get to command prompt
    ... This is in regard to a notebook computer running ... >> prompt if the system doesn't even log in to the desktop. ... >> Will the XP boot disk allow me to get to a command prompt ... > The solution, in her case, was to insert the last OEM restore CD in the ...
    (microsoft.public.windowsxp.security_admin)
  • Re: passwd
    ... Every user can change his/her own password, the only difference from passwd ... command used by root is that they are prompted to enter existing password ... so it doesn't match the password that user enters in the prompt for ... >>manipulation error. ...
    (RedHat)
  • Re: Change User Password
    ... these are sections from my man pages on passwd: ... passwd does not prompt privileged users ... The login name is not prompted for ...
    (comp.unix.solaris)