Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 3425  / 2 Years ago, fri, september 30, 2022, 12:07:16

I added some commands to the bash script and those commands need root permission. So then I added sudo keyword to those commands. As the normal way, I added this script to the crontab file to automate my task.


Is there any way to give root access when it tries to run automatically?


Note: I'm using crontab to automate my script.


More From » bash

 Answers
1

Yes. Read man sudoers sudoedit. You can give a single user passwordless access to a set of commands. You can specify a date range for the access, so if your script is only run between 03:00 and 03:15, you can allow access only then.


[#1337] Saturday, October 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rieency

Total Points: 299
Total Questions: 116
Total Answers: 111

Location: Wales
Member since Tue, Dec 14, 2021
2 Years ago
rieency questions
Wed, Aug 25, 21, 15:17, 3 Years ago
Wed, Jun 23, 21, 04:37, 3 Years ago
Thu, Feb 24, 22, 00:50, 2 Years ago
Mon, Mar 28, 22, 13:28, 2 Years ago
Tue, Sep 20, 22, 15:25, 2 Years ago
;