Linux SUDO-hack

It can happen, you have sudo-access to another account (most of the time it will be access to the root account). But most of the time the NOPASSWD option is not used due to security reasons. But there are moments you want to have sudo-credentials available, think about a script or something else.... I had the same issue, so I found the next "hack" to get the timestamp refreshed every 60 seconds.

(Please note the script will use user "root" but it can be another user, please modify the scripts so it fits your needs).

Step 1)

Create a script in you $HOME/bin with the next content (I call it

while [ true ];
sudo -u root /bin/true > /dev/null 2> /dev/null
sleep 60

Step 2)

Get a valid sudo-timestamp:

$ sudo -u root /bin/true

Step 3)

Start in the background:

$ $HOME/bin/ &

That's all!