home   articles   tags   browse code   

Linux SCP Expect Script


 

usage: expect_scp.exp myfile.7z
file: expect_scp.exp
#!/usr/bin/expect -f
set filename [lindex $argv 0]
set timeout -1
spawn scp $filename myusername@192.168.1.123:/home/myusername/
set pass "mypassword"
expect {
        password: {send "$pass\r" ; exp_continue}
        eof exit
}


192.168.1.123 - change to the ip address of destination server
myusername - change to user account of destination server
mypassword - change to password of user account of destination server


 

Tags: bash, linux
 


 

 



Related Articles
 



home  |  privacy policy  |  terms of use  |  contact  


©2010, Zedwood Digital