Automatic scp command

Secure Copy or SCP is a means of securely transferring computer files between a local and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol. When we use this command, we must prompt password to copy file from other host. We can use upload public key for automatic, but we can use other method to bypass input password.

Expect is a useful tool for feeding inputs automatically to an interactive program. Expect  is a program that “talks” to other interactive programs accord‐ing to a script. This is a sample code to bypass password when use scp command :

This is a simple script to bypass command from konsole. You can use other command (ex. ssh, ftp, etc) with expact, so you can bypass other parameter from that command.

Source :
http://wiki.tcl.tk/11583
http://myithaca.wordpress.com/2009/06/21/expect-scripting-tutorial/

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.