• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Ftping files through scp

I'm in the process of writing a shell script with copies files from one linux box to another using scp. I wish to run this through a cronjob so it cannot be interactive.

This is what I have so far.

#!/bin/sh
PASSWD='passswd'
dateset=$( date | awk '{print $2 $3 $6}')
for dates in $dateset; do
dateset2=$dates
done
cd /home/user
scp -r user@host:/home/user/$dateset2.db.gz . << END_SCRIPT
quote PASS $PASSWD
END_SCRIPT
exit 0

it still asks me for the password though.

It works if I use ftp (but I'd rather use something more secure)

Might anyone be able to offer suggestions?
 
you can also use sftp -b and supply a batch file (read the manpage for more info).

Although you should be using key's anyways with ssh because its more secure.
 
Originally posted by: nweaver
another vote for keys

otherwise I think expect might be a better language to script this in

Yeah. And if you're using unencrypted private keys, try to set up a seprate user on the other machine that doesn't have write access to anything except the directory you're scp'ing too. I think there's also a way to restrict what programs can be run when logged in via certain keys (in the authorized_keys file on the line for the key?)

This is a decent link to check out http://www.kuro5hin.org/story/2001/10/21/134817/35#introtocrypto .
 
Back
Top