Most of the time, a linux script writer must have encountered reasons to automate the scripts that require login to the server, copying of data without the need of giving a password at the shell prompt. Most of the time, people will settle down with setting up the secure key access. ie, using authorized keys. But there is also another way of automating login to the servers. It is by using the expect script.
If expect is installed on your machine you can see it at /usr/bin/expect....