Root permission to change date and time

Asked

Viewed 107 times

1

I would like to know how to get my script to be allowed to change the date and time of the system without asking to enter the root password?

  • 1

    Just out of curiosity, what advantage would someone have to put a wrong time on the system? Because if you want the right one, you can use NTP, right? It’s something offline?

1 answer

1


You will have to edit the file /etc/sudoers adding:

[user] ALL=NOPASSWD: /path/to/script.sh

  • 4

    This is kind of dangerous if the user can edit the script, right? It would be better to only allow the change of time.

  • Yes, but the very proposal of the question is already unsafe

  • Insecure in what sense? Of course, letting it move on time is already a conceptual mistake, but it doesn’t mean you have to allow everything right?

  • 2

    I don’t think it can be deduced that way, just because the question "seems" to suggest something dangerous, you’re going to suggest a dangerous solution? Anyway, adding the warning regarding the risks of the command is always essential.

  • 1

    Instead of giving permission to run the script as SU, it would be better to give permission to run the date. and even then, make sure that the user is not allowed to change the date. (actually has other care to take, but it is already better than giving permission for whole script run as SU) - somehow I find it important whenever the subject is security to explain in response the risks involved

Browser other questions tagged

You are not signed in. Login or sign up in order to post.