forward sudo verification

Posted by Timo Kluck on Ask Ubuntu See other posts from Ask Ubuntu or by Timo Kluck
Published on 2012-10-15T12:27:03Z Indexed on 2012/10/15 15:54 UTC
Read the original article Hit count: 238

Filed under:

I often use the following construct for building and installing a tarball:

sudo -v && make && sudo make install

which will allow me to enter my password immediately and have everything done unattended. This works well except in the rare case that building takes longer than the sudo timeout, which may happen on my rather slow machine with large projects (even when using make -j4).

But when the build takes a long time, that's exactly when doing things unattended has a great advantage. Can anyone think of a shell construct that allows me to input my password immediately, and which has make executing under normal permissions and make install under elevated permissions?

For security reasons, I don't want to configure my user to use sudo without password.

A viable option is to set the timeout to very long, but I'm hoping for something more elegant.

© Ask Ubuntu or respective owner

Related posts about sudo