Difference between revisions of "How to set the default root password"
m (→On host) |
(→On host) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
− | By default on buildroot there is no password for root user. It is not really secure and can be a problem for some packages like [[dropbear]]. | + | By default on buildroot there is no password for root user. It is not really secure and can be a problem for some packages like [[SSH |dropbear]]. |
This page explain how to set a default password on our board. | This page explain how to set a default password on our board. | ||
Line 23: | Line 23: | ||
If we have a big production of APF* to flash with the same default password it will be really painfull to change it on each boards. The best way is then to change it under your rootfs. | If we have a big production of APF* to flash with the same default password it will be really painfull to change it on each boards. The best way is then to change it under your rootfs. | ||
− | * First we need the debian/ubuntu package '''whois''' (wich is installed by default). Then | + | * First we need the debian/ubuntu package '''whois''' (wich is installed by default). Then generate the crypted password : |
<pre class="host"> | <pre class="host"> | ||
Line 52: | Line 52: | ||
== Links == | == Links == | ||
+ | * [[Adding_users]] | ||
* [http://elinux.org/images/2/2a/Using-buildroot-real-project.pdf Buildroot presentation of Thomas Petazzoni] (page 25). | * [http://elinux.org/images/2/2a/Using-buildroot-real-project.pdf Buildroot presentation of Thomas Petazzoni] (page 25). |
Latest revision as of 08:53, 11 October 2013
Contents
Introduction
By default on buildroot there is no password for root user. It is not really secure and can be a problem for some packages like dropbear. This page explain how to set a default password on our board.
On target
The straitforward way to set the root password is to login on the board then type :
# passwd Changing password for root New password: Bad password: too short Retype password: Password for root changed by root
If your password seems to be too simple for the system it will tell it, but the password is changed.
On host
If we have a big production of APF* to flash with the same default password it will be really painfull to change it on each boards. The best way is then to change it under your rootfs.
- First we need the debian/ubuntu package whois (wich is installed by default). Then generate the crypted password :
$ mkpasswd Mot de passe : 3DHrA1GdEo2u6
The hash for password 'toto' is generated. Then we have to put it in our shadow file under rootfs. To do that, edit your file buildroot/output/target/etc/shadow, and replace the line:
root::10933:0:99999:7:::
By
root:3DHrA1GdEo2u6:10933:0:99999:7:::
If you prefer bearded commands you can also type :
sed -i ’s%^root::%root:3DHrA1GdEo2u6:%’ $TARGETDIR/buildroot/output/target/etc/shadow
- Then regenerate your rootfs.
- You will then need a password for root when you will run your board.