Pages

Monday, November 22, 2010

Single-line sftp command

This trick ussually needed at automation process.
There are several alternatives:

Create this file:
#!/usr/local/bin/expect
spawn  sftp  -b cmdFile user@yourserver.com
expect "password:"
send "shhh!\n";
interact
This will spawn sftp in batch mode and pass in the password shhh! to the program. SFTP will than execute all the commads in cmdFile

cmdFile:
lcd /home/ftp/test
cd /home/ftp/somedir
mput *.dat
lcd /home/recieving
cd /home/someotherdir
mget *.dat
  • ssh public key 
  • using specific tools

No comments:

Post a Comment