3

We've added bash to our buildroot configuration and would now like to make it the default shell for the root user. I'd prefer not to add a passwd file to our overlay so is there some way through buildroot's config to make the root shell default to /bin/bash rather than /bin/sh?

cake_in_a_bag
  • 73
  • 1
  • 7

1 Answers1

8

You can set the shell for all users to bash by setting BR2_SYSTEM_BIN_SH_BASH, i.e. in menuconfig set System configuration -> /bin/sh to bash. This will generate /bin/sh as a symlink to bash.

To set it for the root user only, you'll need a post-build script such as:

#!/bin/sh
sed -i '/^root:/s,:/bin/sh$,:/bin/bash,' ${TARGET_DIR}/etc/passwd
Luca Ceresoli
  • 1,591
  • 8
  • 19