I have few bash scripts which are adding to cron jobs with specified timing, but it needs to be executed as root user. I am trying to run those scripts i.e., crob jobs but it needs root user permission, since I am running this jobs in ubuntu ec2 instance where root user is restricted. What would be the work around to run those scripts as root user.
Thanks
Best Answer
I'm not familiar with EC2, but you can define a list of commands which can be executed by
sudo
without password prompt. Runvisudo
and insert something like this:after that just use
sudo
in the bash scripts and put these in your cron job.