I am trying to transfer some files using SCP in a shell script, but I am being prompted for my password on the remote machine.
Can I use expect with scp to enter the password so I don't have to type it in all the time?
You don't. Use a key instead.
Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).
Yes, you can.
spawn /usr/bin/scp -l 200 file.ext user@server://path/on/server/
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
4 years ago
2 years ago