How to set busybox as login shell of a user?
Solution 1
busybox
command isn't an interactive shell. As Thomas said, you should run busybox sh
for its interactive shell. Use these commands to set busybox interactive shell as login shell of user MYUSER:
echo "/bin/busybox sh" > /bin/ibusybox
chmod +x /bin/ibusybox
usermod -s /bin/ibusybox MYUSER
Also using ibusybox
will run busybox interactive shell.
Solution 2
You would have to start busybox
with sh
as parameter. Best would be to write a little wrapper:
mkdir -p /usr/local/share/busybox
echo "/bin/busybox sh" > /usr/local/share/busybox/sh
chmod +x /usr/local/share/busybox/sh
Then test the login:
su - -s /usr/local/share/busybox/sh wood
If successful you can add /usr/local/share/busybox/sh
as the user's shell.
usermod -s /usr/local/share/busybox/sh MYUSER
I quickly tried to symlink busybox
to /usr/local/share/busybox/sh
but that did not work. So therefore the wrapper script.
Related videos on Youtube
Reza Ghodsi
Updated on September 18, 2022Comments
-
Reza Ghodsi over 1 year
I customized my
BusyBox
to include some specific applets. Now I want a user login toBusyBox
as its shell. I mean when that when user enters its username and passwords, he will bed redirected to an environment that only my desired applets are usable. Changing login shell of the user using following command does not work:usermod -s /bin/busybox MYUSER
using
su MYUSER
only showsBusyBox
help but I need an interactive shell includes only my desired applets. Any solution? -
Reza Ghodsi over 7 yearsCannot execute /usr/local/share/busybox/sh: Permission denied
-
Thomas over 7 yearsForgot to mention to make it executable. Updated the answer.