How do I set up busybox to allow a non-root user to set the date?

11,834

If you have the "suid" version of busybox, you could try to make the date command execute as root like this:

File /etc/busybox.conf:

...
[SUID]
date = ssx root.root
...
Share:
11,834

Related videos on Youtube

AllenKll
Author by

AllenKll

Just this guy... You know? I am nerdier than 100% of all people. Are you a nerd? Click here to take the Nerd Test, get geeky images and jokes, and write on the nerd forum! http://www.nerdtests.com/images/ft/nq/9df5e10593.gif

Updated on September 18, 2022

Comments

  • AllenKll
    AllenKll almost 2 years

    I have an embedded system built with busy box. I allow a user named "app" to download a program/script to a directory and it will be run on boot.

    The program should be allowed to set the date. It is run as 'app' user.

    How do I set busybox to allow the non-root user 'app' to set the date? I have tried to add the suid permission:chmod u+s /bin/busybox.nosuid But it doesn't work. Also busybox is very anemic on why there is nosuid and suid versions, but apparently they've been compiled with different apps in them. There is no 'sudo' on the system.

    root# which date
    /bin/date
    root# ls -l /bin/date
    lrwxrwxrwx    1 root     root            19 Apr 22  2016 /bin/date -> /bin/busybox.nosuid
    root# ls -l /bin/busybox.nosuid
    -rwsr-xr-x    1 root     root            14 Apr 22  2016 /bin/busybox.nosuid
    root# date
    Thu Jan 15 03:43:24 CET 1970
    root# date -s 10:30
    Thu Jan 15 10:30:00 CET 1970
    root# date
    Thu Jan 15 10:30:01 CET 1970
    root# su app
    app$ date
    Thu Jan 15 10:30:10 CET 1970
    app$ date -s 11:00
    date: can't set date: Operation not permitted
    Thu Jan 15 11:00:00 CET 1970
    app$ date
    Thu Jan 15 10:30:21 CET 1970
    
  • AllenKll
    AllenKll about 8 years
    That was the missing magic! You should add a bit about the permissions for busybox and busybox.conf as noted here: git.busybox.net/busybox/plain/Config.in