I'm trying to change the root login shell to become /opt/bin/bash or /opt/bin/zsh. Since /etc/passwd and /etc/groups are being pulled from the firmware, and there is no usermod type utility that I can see to do it,
The only thing I can think of is doing a sed or awk on /etc/passwd to do this. Additionally, how do I let it fallback to /bin/sh if say I my /opt partition fails (being on a USB drive and all)? I'm thinking /jffs/scripts/services-start:
Any better or possibly safer way to do this? I really don't like poking at the root login
Note: Tested the code in sh and busybox awk, but not the script.
The only thing I can think of is doing a sed or awk on /etc/passwd to do this. Additionally, how do I let it fallback to /bin/sh if say I my /opt partition fails (being on a USB drive and all)? I'm thinking /jffs/scripts/services-start:
Code:
#!/bin/sh
# Replace root shell
ROOT_SHELL=/opt/bin/bash
[ -x $ROOT_SHELL ] && awk -F: "{sub(/\root:\/bin\/sh/,\"$ROOT_SHELL\"); print;}" /etc/passwd
Any better or possibly safer way to do this? I really don't like poking at the root login

Note: Tested the code in sh and busybox awk, but not the script.