gpt4 book ai didi

Buildroot:更改默认根外壳

转载 作者:行者123 更新时间:2023-12-05 01:00:28 28 4
gpt4 key购买 nike

我们已将 bash 添加到我们的 buildroot 配置中,现在希望将其设为 root 用户的默认 shell。我不希望将 passwd 文件添加到我们的覆盖中,所以有没有办法通过 buildroot 的配置使 root shell 默认为/bin/bash 而不是/bin/sh?

最佳答案

您可以通过设置 BR2_SYSTEM_BIN_SH_BASH所有 用户的 shell 设置为 bash,即在 menuconfig set System configuration -> /bin/shbash。这将生成 /bin/sh 作为 bash 的符号链接(symbolic link)。

要仅为 root 用户设置它,您需要一个构建后脚本,例如:

#!/bin/sh
sed -i '/^root:/s,:/bin/sh$,:/bin/bash,' ${TARGET_DIR}/etc/passwd

关于Buildroot:更改默认根外壳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49536836/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com