0

I am doing several operations installing packages etc and one of those are

sudo apt-get update && apt-get install -y curl

obviously it asks my password.

Now, I would like to put all the operations I did in a script so that other people can do it too.

But how do I put this operation in a script if it requires that the user enters the sudo password?

(before in a dockerfile what I did was to mark first the USER as root and RUN the command, but I am not using docker this time)

1 Answers1

0

A similar question was answered here .

To summerise, you should not be using sudo inside a shell script, rather run the whole script with sudo privilage.

sudo ./script.sh

Otherwise, if you still want, you can do,

sudo -u username command