How to start bash shell in openwrt

I am new to openwrt
as soon as I login to machine and check shell using below command
echo $SHELL
---> /bin/ash

Then I type the command bash to start bash shell . even after that I check shell and result is same.

echo $SHELL
---> /bin/ash

How to start Bash shell ?

have you installed the bash package ?

yes

root@OpenWrt:~# opkg install bash
Package bash (5.1-2) installed in root is up to date.
root@OpenWrt:~#

Tried running bash?

yes

root@OpenWrt:~#
root@OpenWrt:~# bash
root@OpenWrt:~# echo $SHELL
/bin/ash
root@OpenWrt:~#

If you want to make bash the default shell, change /bin/sh to link to bash.

1 Like

Or edit /etc/passwd so the root shell is bash?

$ grep root /etc/passwd
root:x:0:0:root:/root:/bin/ash
3 Likes

…just be aware that setting a non-default shell as login shell introduces a rather high risk of locking yourself out after a sysupgrade, as your new(ly installed) image won't ship with bash installed, while root's shell references /bin/bash.

Possible, but not recommended (and even less recommended would be touching the /bin/sh symlink, which could end you up in even more tricky situations).

4 Likes