How to set busybox as login shell of a user?

I customized my BusyBox to include some specific applets. Now I want a user login to BusyBox 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 shows BusyBox help but I need an interactive shell includes only my desired applets. Any solution?

2 Answers

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.

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.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like