15 49.0138 8.38624 1 0 4000 1 https://www.techpulsetoday.com 300
sudo password

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>

For Example:

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

man sudo
How to check the number of protocol connections made in a server
How to search for and replace a string in the file name

Thanks for stopping by guys! I'm Vijayan and Techpulse is my beloved brainchild. Currently working as a PHP developer in a digital marketing start-up, I'm overly passionate about not just learning new things but also putting those into practice. I swear by a quote I once came across... 'What separates successful people from unsuccessful people is the former's ability to execute'. Feel free to reach out to me if you have any questions, suggestions or feedback. Hoping to see more of you here!

0 Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.