3

I am trying to list all the cron jobs for all the users in my Ubuntu system using the following command:

for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done

Why am I getting the following error:

must be privileged to use this -u

1 Answer 1

4

You don't have the necessary permissions to read other users' crontabs, either run as root or use sudo to invoke crontab -u, e.g.

for user in $(cut -f1 -d: /etc/passwd); do sudo crontab -u $user -l; done

or

awk -F: '{print $1}' /etc/passwd | xargs -n1 sudo crontab -lu

You must log in to answer this question.

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