How to avoid sudo password prompt
Here is the simple tip which gets rid of this password prompt, follow these tweaks if you have a situation where you don’t want to enter the root password while running the sudo command as a non-root user. We can avoid prompts for passwords by giving the sudo password as a standard input to the sudo command, as shown below:
echo <password> | sudo -S <command>
echo 'password' | sudo -S cp wp-config.php bkp-wp-config.php
Here, the echo ‘password‘ will send a password to the output, where | will send this as standard input to the sudo command run with the -S parameter.
-S is -stdin, which reads, the password from the standard input.
for more information about sudo, type man sudo