How to list all 'at' jobs without root privileges?

5,205

Solution 1

This may not be the answer you want, but strictly speaking, you could boot a Live CD and use that to look at the files in /var/spool/at (or equivalent).

The privacy and security provisions of Unix/Linux does not allow you to do what you want. The at files are stored by default with "other" read privilege set to off.

Solution 2

you might create a custom little program that runs atq and give it suid root.

beware that:

  • if you do something wrong, it will be very easily exploitable to gain root access
  • you can't suid a script, it has to be an executable
Share:
5,205

Related videos on Youtube

klew
Author by

klew

Updated on September 17, 2022

Comments

  • klew
    klew almost 2 years

    For listing jobs added by at and batch I use atq, but it lists only my jobs. I can run atq with root privileges and then it lists jobs from all users.

    How can I list all jobs without root privileges?

  • klew
    klew over 14 years
    Ok, so maybe I can start some deamon/program in cron/etc with root privileges that provide this data for non-root users. Is there any tool that do this? Or maybe you have some suggestions how to do it with scripts?
  • user1686
    user1686 over 14 years
    int main(int argc, char *argv[]) { setreuid(0, 0); argv[0] = "/usr/bin/atq"; exec(argv[0], argv); return 0; }
  • kmarsh
    kmarsh over 14 years
    Assuming it was compiled by root and chmoded to setuid, this would run atq for a regular user as root, in a similar manner as sudo /usr/bin/atq. But it would still run with root privileges.
  • klew
    klew over 14 years
    Ok, it works, but I changed exec() to execv() (it didn't compile with exec() ). Thanks! I think that to get this informations without root privileges (at least when running a something-like-atq) I could add a cron job that grabs this data as root and stores it in a file which is readable for everyone.