Pergunta

I need to run some commands in parallel including SCP. For this I'm using GNU Parallel. The problem is I don't know how to pass the password to SCP. This is a line similar to the one I'm running:

ls 2011_* | parallel scp {} user@domain

And if ls finds 3 files, scp ask 3 times for password at the same time and I can only input the password to the last process to prompt for it.

I temporarily solved this issue connecting using a public key, but this won't be an option in the future due to company policies. I read the SCP man pages and I couldn't find an option, but I'm quite confident that Parallel should have an option to allow me to input the password.

Somebody knows a way to solve this?

EDIT: I want to know if there is a way I can tell parallel the password so it can give it to scp each time it asks for it. Maybe with something like this:

ls 2011_* | parallel scp {} user@domain < file_with_password.txt

But specifying that the redirection of STDIN is for scp and not for ls or parallel.

Foi útil?

Solução

You will want to look at ssh-agent: The benefit of having a passphrase protected certificate with the convenience of typing your passphrase only once.

Outras dicas

parallel sshpass -p $PASS scp -P $PORT -rp {} ~/to_dir ::: $ADDRESS:~/from_dir/*
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top