1

I want to do sudo -i within a bash script but also want to pass in the sudo username and password at the same time. Is that possible?

i.e. something like:

echo PASSWORD | sudo -k -S -i -u USERNAME
2one
  • 111
  • There are security issues with that method. An intruder will be able to see the root password in clear text, when reading the shellscript. There are other ways to make it possible to run one or a few tasks without password, that should be less risky than entering the password like that. See the answers at this link. – sudodus Sep 27 '19 at 12:07

0 Answers0