Forum Moderators: bakedjake
Just curious if anyone could help me with this.
I'm trying to write a script that can transfer files from 1 machine to another through ssh.
Unix machine, ksh, OpenSSH, and a version of sftp.
I can automate everything except the pass when doing sftp.
I just do something similar to the below
sftp -b /devfd/0 user@mysshserver << EOF
cd /tosomewhere
mput *.txt
bye
EOF
I however now have a nightly process that I wish to script the entire process(including the password). For some reason, the things I've tried do not work, either SFTP doesn't support what I thought would work, or I can't seem to get the SSH scripting correct. It errors out, and I can't clean it up.
Can anyone suggest a way for me to do my file transfer totally scripted?
This is a bit of a security risk, though, because if somebody gains acces to the "connecting" machine, they then can gain access to the "connected to" machine.
However, you can mitigate this by restricting SSH use for that keypair to only your script. If you have multiple scripts, you can create multiple keypairs, and have each one restricted to a specific script.