From: Ignoramus19021 on
I want a NON-INTERACTIVE command to set root password.

Similar to how I can set a samba password by supplying an encrypted
password on command line, or a password for the user in a self install
CD.

I am not interested in BS lectures about security.

This is for a large number of GUI-less production machines that we'll
be setting up, not for grandma's web browser box. The machines are all
fully configured with a big install script, except that I need to set
root password manually, which I do not like to do.

So. Is there some way to set

set-encrypted-password root <encrypted password>

thanks

--
Due to extreme spam originating from Google Groups, and their inattention
to spammers, I and many others block all articles originating
from Google Groups. If you want your postings to be seen by
more readers you will need to find a different means of
posting on Usenet.
http://improve-usenet.org/
From: Chris F.A. Johnson on
On 2008-06-24, Ignoramus19021 wrote:
> I want a NON-INTERACTIVE command to set root password.
>
> Similar to how I can set a samba password by supplying an encrypted
> password on command line, or a password for the user in a self install
> CD.
>
> I am not interested in BS lectures about security.
>
> This is for a large number of GUI-less production machines that we'll
> be setting up, not for grandma's web browser box. The machines are all
> fully configured with a big install script, except that I need to set
> root password manually, which I do not like to do.
>
> So. Is there some way to set
>
> set-encrypted-password root <encrypted password>

man passwd:

--stdin
This option is used to indicate that passwd should read
the new password from standard input, which can be a
pipe.


--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
From: Ignoramus19021 on
On 2008-06-24, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
> On 2008-06-24, Ignoramus19021 wrote:
>> I want a NON-INTERACTIVE command to set root password.
>>
>> Similar to how I can set a samba password by supplying an encrypted
>> password on command line, or a password for the user in a self install
>> CD.
>>
>> I am not interested in BS lectures about security.
>>
>> This is for a large number of GUI-less production machines that we'll
>> be setting up, not for grandma's web browser box. The machines are all
>> fully configured with a big install script, except that I need to set
>> root password manually, which I do not like to do.
>>
>> So. Is there some way to set
>>
>> set-encrypted-password root <encrypted password>
>
> man passwd:
>
> This option is used to indicate that passwd should read
> the new password from standard input, which can be a
> pipe.
>
>

I think that your passwd is different from my passwd, mine does not
have this option. And I would prefer to deal with an excrypted
password.
--
Due to extreme spam originating from Google Groups, and their inattention
to spammers, I and many others block all articles originating
from Google Groups. If you want your postings to be seen by
more readers you will need to find a different means of
posting on Usenet.
http://improve-usenet.org/
From: Dave B on
Ignoramus19021 wrote:

>>> I am not interested in BS lectures about security.
> And I would prefer to deal with an excrypted password.

Uhm...reread the two phrases above. Anyway, why not edit /etc/shadow
directly then?

awk -F':' -v OFS=':' '/^root/{$2=encryptedpassw}1' /etc/shadow > newshadow

--
D.
From: Dave B on
Dave B wrote:
> Ignoramus19021 wrote:
>
>>>> I am not interested in BS lectures about security.
>> And I would prefer to deal with an excrypted password.
>
> Uhm...reread the two phrases above. Anyway, why not edit /etc/shadow
> directly then?
>
> awk -F':' -v OFS=':' '/^root/{$2=encryptedpassw}1' /etc/shadow > newshadow

With sed you can even do in-place editing (carefully):

sed -i 's/^root:[^:]*/root:encryptedpassword/' /etc/shadow

--
D.