call halt/reboot as user

Denys Vlasenko vda.linux at googlemail.com
Mon Jan 3 12:33:06 UTC 2011


On Mon, Jan 3, 2011 at 11:25 AM, Arno Steffen
<arno.steffen at googlemail.com> wrote:
> 1) I want normal user give the permission to reboot or halt the system.
> With current implemented busybox it is not allowes - I just get a NO.

Because reboot tries to initiate reboot, but gets EPERM.
(BTW, can you please upgrade to something newer than busybox-1.13.x?)


> I already changed the link from /sbin/reboot to /bin/reboot or changed
> permission, but this doesn't help.

Possible approaches:
* Make a new user with uid 0 and login shell=/sbin/reboot.
  or
* Use sudo mechanism to allow some users to run /sbin/reboot
  or
* Make busybox binary setuid root, and change reboot applet from
  _BB_SUID_DROP to _BB_SUID_MAYBE in this line:
  IF_HALT(APPLET_ODDNAME(reboot, halt, _BB_DIR_SBIN, _BB_SUID_DROP, reboot))
  (warning: this will allow any user to run reboot)


> 2) when user is logged in, I can't change to root, as login command
> can only be run as superuser.

Works for me as long as busybox binary is setuid root:

$ busybox login
myhost login: _


> How can I change the user?

Using su command.

-- 
vda


More information about the busybox mailing list