Search code examples
bashhaskell-turtle

How to pass a password to scp with Turtle?


This is what I got:

shell
    "scp -r /path_to_some_dir some_user@some_ip:destination_path"
    empty

and, naturally, I get prompted for the password.

Can the inputting of the password be automated with Turtle?


Solution

  • If you must use a password, you could use sshpass:

    shell
        "sshpass -p \"password\" scp -r /path_to_some_dir some_user@some_ip:destination_path"
        empty
    

    You could also use the argument -f and supply it with a text file containing the password instead, e.g. if you don't want the password to be hard-coded into your script, or displayed in the bash history.

    Otherwise you could consider using SSH keys instead.