如何更改OpenWrt的默认shell?

Kum*_*Tea 2 linux openwrt busybox fish ash

OpenWrt的默认shell是ash,但我想将其更改为fish.

当我运行chsh -s /usr/bin/fish( 的绝对路径fish)时,它返回了-ash: chsh: not found

我改变了第一行/etc/passwd

root:x:0:0:root:/root:/bin/ash

到:

root:x:0:0:root:/root:/usr/bin/fish

我无法再次登录(密码错误),系统日志显示:

authpriv.warn dropbear[14288]: User 'root' has invalid shell, rejected


还有其他方法可以更改默认 shell 吗?

(顺便说一句,我使用的是OpenWrt 的流行分支而不是官方的,但这似乎不是这个问题的原因)

小智 5

chsh -s /usr/bin/fish是正确的。但是openwrt没有安装chsh命令。您需要 opkg install shadow-chsh先运行安装 chsh 命令。然后运行 chsh -s /usr/bin/fish 最后运行 echo $SHELL看看是否替换成功。

注意,以上操作需要root权限才能运行。

抱歉我的英语不好,希望你能理解。