I\'m writing a bash script that needs to sudo multiple commands. I can do this:
( whoami ; whoami )
but I can\'t do this:
sudo
sudo only asks for your passwd the first time.The passwd answered is valid for about 5 minutes by default.You can change this value as this told.So just worry about the passwd prompt at the beginning of your script,then you can use sudo through out. changing Defaults:user_name timestamp_timeout's value to -1 may be a security hole on your system.