Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Apr 2004 12:48:59 +0200 (CEST)
From:      "Julien Gabel" <jpeg@thilelli.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: changing root password.
Message-ID:  <50433.192.168.0.105.1081162139.squirrel@webmail.thilelli.net>
In-Reply-To: <6.0.3.0.2.20040405112307.024b63c8@cygnus>
References:  <6.0.3.0.2.20040405112307.024b63c8@cygnus>

next in thread | previous in thread | raw e-mail | index | archive | help
> I've got a 4.8R system that I use for development of a 'freebsd-small'
> type network device.  The network device environment runs out of
> memory, the kernel and an mfsroot.gz image coming from a 32Mb pccard
> Compact Flash drive.
>
> The mfsroot.gz development image is stored as a vnconfig vn0
> virtual node, called 'mfsroot', on the development machine.
>
> Everything boots and I can do what I want with the system.
>
> The problem is that I need to be able to set the root password
> of the device, from the development machine prior to moving to
> the actual device.
>
> So I (or rather, 'root') mount(s) the virtual fs node:
>
> % vnconfig vn0 mfsroot
> % mount /dev/vn0 /mnt
>
> (under /mnt now is a partially functional FreeBSD 4.8R based
> installation, including /etc/master.passwd, etc)
>
> And then change the root directory to the mount point:
>
> % chroot /mnt
>
> And then try to change the password:
>
> % passwd
> Type new password:
> Retype new password:
> ...
> %
>
> The behavior I'm seeing is that the /original/ /etc/ password
> files and databases are updated, and not the [/mnt]/etc/ password
> files.
>
> Am I expecting incorrectly?  Am I going to be able to change the
> network device's root password before moving to the actual device
> from the development machine, or will it be necessary to put
> /usr/bin/passwd onto the network device?

The problem is that passwd(1) works only on /etc/master.passwd and
/etc/passwd. In order to set the password, I think the simplest way
is to set the wanted password on another system and copy & paste it
using vipw(8) using 'vipw -d /mnt/etc'.

-- 
-jpeg.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50433.192.168.0.105.1081162139.squirrel>