My command is
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
I want to pass my password user-password
as an argument in the above command similar to the one shown below:
echo user-password | sudo -S apt-get update
My issue is that i don't know how to pass both the URL as well as the sudo password simultaneously.
Also i am ensuring that the password is not visible on the terminal as this command will be called by a python script which reads the password from a file (or from user)
sudo
and using the password as a parameter. The OP already has this part figured out. This is a question about piping tosudo tee
with an extra argument-S
and where does theecho <password>
get placed in this chain? – WinEunuuchs2Unix May 17 '18 at 00:14sudoers
is not acceptable in their case. I believe using plaintext password on the command line should be avoided. – Melebius May 17 '18 at 05:48