Setup CRON jobs under root for another user.
Hello Everyone,
Could someone please help me with below issue;
I have some performance scripts that run under 'khattak' user id. This is id is being used by few other users. The issue is, some users are entering the password wrong and after 3 consecutive passwords, my id is getting locked which causing the cronjobs not to run and affecting my servers. I cant stop users from using that id since this is an app ID. I am thinking of setting up all the scripts under root user so even if the "khattak" id gets locked out. performance scripts will still run. I thought adding su - khattak -c "command that I use in a script" would work but it is not working as expected. I know I am doing something wrong here. I get this error messsage;
su: invalid option -- 'r'
Try `su --help' for more information.
su: invalid option -- 'o'
Could someone please tell me what command to use in a script so if I setp cronjobs under root users , it will still run as khattak? Below is one of the scripts I am using. The /khattak directory and all subdirectories are owned by khattak user.
#!/bin/bash
#
#
su - khattak -c find /khattak/apt/axes/cache -type f -mmin +2 \! -name '*.out' -exec rm "{}" ";"
Thank you,
|