How can I run sudo commands during a deployment?
There may be occasions where you need to run sudo commands during a deployment.
Because the deployment process is non-interactive, it's not possible to provide a password when running SSH commands, however, we can recommend creating a specific entry in your sudoers file to allow the deployment user to run only the necessary commands, and to do so without a password.
If you place the following line in your /etc/sudoers file, replacing "username" with the username of the deployment user, and "command" with the full command that needs to be executed, then this user will be able to use sudo to execute only this command and do so without needing a password.
username ALL=(ALL) NOPASSWD:command