Password less sudo in script

If you are running the script as the same user as the one that has no password access then it should work correctly, i would make sure that the script is running as the correct user, I would also test the script by manually calling it as the right user.

You may also need to check that the following line doesn't exist in the sudoers file or that you have a further line which states your user doesn't require a TTY

Defaults requiretty

if that line is present you can either comment it out (not a good idea) its probably better to add the following in

Defaults:<USERNAME> !requiretty

where USERNAME is your user


I think you need to use ssh -t