Recently I came across a problem. I created a deploy script that would SSH into the server and run a bunch of commands, and some of those commands required sudo, but when running commands as sudo presented a password prompt, which was a problem.
I solved this by updating the sudoers file in ubuntu. If you ever face this problem all you have to do it update the file /etc/sudoers on your server
sudo nano /etc/sudoers
Add this line to the end of the file
ubuntu ALL=(ALL) NOPASSWD: ALL
That’s it! Feel free to comment if you have any questions or suggestions.