|
|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Gurdeep Singh wrote:
>Hello,
>
>Can anyone guide me on automating SCP.
>
>I wish to transfer files through SCP twice daily, as an automated cron
>job.
>Can anyone help me with a script which will do this.
>I wish to use SCP with password only.
>
>Regards,
>
>Gurdeep
>
>
Hi Gudeep,
Sounds like you are looking for expect. Although this requires that
you put the password into the script itself which is usually not a good
idea. So with that caution in mind here is a sample script:
#!/usr/bin/expect --
set timeout 100
set PASS "yourpassword"
set USER "username"
spawn scp /some/file $USER@somehost:/some/other/path
expect "password"
send -- $PASS\r
expect eof
Just remember that this is not a very secure way of doing this, but it
will do it.
Hope that helps ya out,
Jeff
Attachment:
pgp00000.pgp
Description: PGP signature
[Home] [Fedora Announce] [Linux Crypto] [Kernel] [Netfilter] [Video for Linux] [Bugtraq] [USB] [Network Security] [Fedora Security]
![]() |
![]() |