Make sure requiretty is set to false before trying to execute sudo
commands