How To Set Job With Different User In Crontab? – POFTUT

How To Set Job With Different User In Crontab?


I have some crontab jobs. I have set up them with root user. But there are some problems. The job does not work because of security issues that prevent job to run with the root user. How can I set a different user to run a crontab job to run a different user than the current user?

Crontab

Crontab is used install, uninstall or list tables of cron daemon. As we know each user have their own tables because of the security restriction. To use crontab the user shouldn’t be defined in /etc/cron.eny

Crontab
Crontab

Install New Job With Different User

We will install a new job with a different user by providing username with -u parameter. As we know to use different user we should have root privileges.

$ crontab -e -u ismail
Install New Job With Different User
Install New Job With Different User

Every night the backup command will run

List Jobs Of Different User

We have added a new job for user ismail. We can list jobs of the different users. We will use crontab command with the -l and -u options.

$ crontab -l -u ismail
List Jobs Of Different User
List Jobs Of Different User

LEARN MORE  Schedule Jobs and Tasks With Windows At Command

Leave a Comment