Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer
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? – klew Nov 24 '09 at 13:57
int main(int argc, char *argv[]) { setreuid(0, 0); argv[0] = "/usr/bin/atq"; exec(argv[0], argv); return 0; } – grawity Nov 24 '09 at 18:03
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. – kmarsh Nov 24 '09 at 18:32
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. – klew Nov 24 '09 at 19:19

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|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .