Score:0

How to input a password when using an alias

us flag

I am using sshpass in order to perform a scp command inside a pretty long script to run and I would like to be able to input a password in advance for this.

It's pretty easy to use the password as a parameter, but then, it's typed in clear in the terminal and is obviously a security breach.

My question is : is it possible to ask for the password so that it doees not appear in the terminal at the start of the script ?

Score:1
in flag

You can use read with -p switch to enter a password:

read -s -p "Enter Password: " password
sshpass -p "$password" ...
us flag
Exactly what I needed, thanks
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.