There are four basic steps to getting a machine so that the pictures will automatically transfer between your machine and the server. There are also a couple of dependencies. Dependencies: If you are running Windows you will need the SSH Secure Shell client (http://www.ssh.com), and you should use a newer versions, as older versions had problems with batch transferring. If you are running Linux you will need an ssh client, like openssh. This should be included with the OS. Steps: 1. Create a key pair. 2. Transfer the public key to the server. 3. Set up the batch file 4. Schedule the batch file to run WINDOWS 1. Generate a key pair. Run the SSH client in Windows, (usually found by Start -> Programs -> SSH Secure Shell -> Secure Shell Client). Click on Edit in the toolbar, then go to Settings. There is a list of various settings. Go to Global Settings -> User Authentication -> Keys. Here click on the button titled Generate New. Click Next at the first screen of the wizard. For now, change the encryption to RSA. Key length doesn't matter too much. Click Next. This might take a little bit of time. It should say at the bottom when it is complete. Hit next and it will ask you to to name the file. Use the name id_rsa. Don't put in passwords. It will issue a warning, but just hit yes. 2. Transferring the key. Now, log into the account that you will want to go into (the one given to you, most likely phtotrans on telenature). Now go back to the Keys window by going through the settings again. Upload the key and remember where you put it (we will have to modify it some). By default it adds the key under the filename plus the pub extension. Now also hit the button on the bottom for configuring the command line program, this is important. Now close out of the window and go back to your session. So we now have id_rsa.pub, probably in the default folder of .ssh2. If the directory .ssh doesn't already exist (ls -al | grep ssh), mkdir .ssh; chmod 0700 .ssh Altering the permissions here is very important. Now if you are using my tool you can stop after this next step, otherwise skip it and go to the other one cat .ssh2/id_rsa.pub | /path/key_converter.plx >> .ssh/authorized_keys2 where path is the path to the key_converter.plx program Without tool cat .ssh2/id_rsa.pub >> .ssh/authorized_keys2 Now you want to go in and remove the lines that look like... ---- BEGIN SSH2 PUBLIC KEY ---- Comment: "[2048-bit rsa, foo@computer, Fri Aug 29 2003 19:11:\ 57]" and just start where the goobly dook starts... Add ssh-rsa and remove the last line ---- END SSH2 PUBLIC KEY ---- Now you want to remove all line ends so that you have one long line. 3. Setting up the batch file. Right now for the batch file you want to have two folders on your desktop, one named "ToGo" and one named "Back". Back is there to keep copies of what you drop off in the "ToGo" in the event that a file is deleted but not copied. Put the batch file you are given on the desktop. Right now it is a bit crude, so you may have to manually modify the batch file. To do this right-click on the icon of the batch file, and choose edit. Replace the path to the desktop with your own, which can usually be done by putting your account name down instead of the default account name. Change the path of the scp on the second line to where scp2.exe is stored on your system. Then save the file and try running it. 4. Adding the batch file to scheduled tasks. Start -> Control Panel -> Scheduled Tasks -> Add Scheduled Tasks. Now a wizard should pop up. Hit next on the first window. Now, it will ask you what program you want to run at regular intervals. Click browse and point it to the .bat file you were provided with. You want the task performed daily. hit next Start time doesn't really matter. For convienient testing, set it a few minutes ahead of the current time. Run it every day. start date. hit next Now it will ask for your name and password. This is the password for the Windows account. If you don't have a password, this may not work in certain versions Windows (ie XP seems to have this problem. For security reasons the scheduler requires a password, even though XP as a system doesn't require a password). Now make sure to click the box that says to open advance properties. It should bring up a new window. Select the schedule tab and hit the button advance. Click the checkbox that says repeat task. repeat task every 1 hours, for 24 hours. (Or whatever you deem is appropriate, although a space of a few minutes is recommended). LINUX 1. Generate key. ssh-keygen -t rsa hit return a couple of times. 2. Transferring the key. Transfer into the account given to you, most likely phototrans on telenature.ncsa.uiuc.edu. ssh into the account and do mkdir .ssh; chmod 0700 .ssh then exit scp .ssh/id_rsa.pub login@the_server:~/.ssh/authorized_keys2. alternativily, if you already have an authorized_keys2 file, or if you are unsure, you can run instead of the last command... tar cvf - .ssh/id_rsa.pub | ssh login@the_server "tar xvfO - >> .ssh/authorized_keys2" 3. Setting up the shell script. See below. You will need a directory ToGo (which is where you'll put the pictures that are getting transferred) and one named Back. The default location referred to by the script is your home directory The script is set up for bash. Feel free to change to your favorite shell. Set HOME_DIR to another directory if you do not want to use your home directory, or modify the TOGO and BACK to whichever folders you want. Set SERVER to whichever server you want to log into (probably the default) set LOGIN to the appropriate login (probably the default). 4. Setting up cron. Pretty simple. Type crontab -e. It should bring up your default editor, which depends on distrobution (normally vi). If you don't have any cron jobs set to run you will get a blank screen. Hit i if in vi to insert text. Put in the line (the spaces are one tab). * */1 * * * /pathtoscript/transferfiles.sh This tells the cron job to save every hour. Type man 5 cron for more information. Of course, chmod u+x transferfiles.sh just to make sure it is executable. included text of perl script and batch file..... I will also make these avaliable in a couple of other ways...I will add the info to this documentation when those are ready. ================================================================== perl file...if you want to follow the instructions above it should be in a file named key_converter.plx. #!/usr/bin/perl #For now, this will only work with rsa keys. #If we have more complex needs I'll go looking for a better conversion program #So delete the first and last line for sure, then delete from Comment to the " $deleting = 0; while (<>) { chomp; if ((/^Comment/) || ($deleting == 1)) { #need to delete everything from Comment: "...". #so for the first line I need to check to see if there are two "" if (/^Comment: \".*\"/) { } elsif (/^Comment: \"/) { $deleting = 1; } #This is in the case of the above where it is a multi-line first comment elsif ($deleting == 1) { if (/\"/) { $deleting = 0; } } } elsif (!(/^----.*----/)) { $string .= $_; } } # quick hack until I figure out how to restrict by computer if (/==^b/) { chop $string; chop $string; } $string = "ssh-rsa ".$string."\n"; print "$string"; ================================================================== batch file (name it whatever you want needs to end in *.bat) You will need to change the paths so that they actually point to your Desktop (ie change the phototrans) Depending on your version of windows, you may have to remove the /F /Q following the del command. copy "C:\Documents and Settings\Administrator\Desktop\ToGo\*" "C:\Documents and Settings\Administrator\Desktop\Back\" "C:\Program Files\SSH Communications Security\SSH Secure Shell\scp2.exe" -BqQ "C:\Documents and Settings\Administrator\Desktop\ToGo\*" phototrans@telenature.ncsa.uiuc.edu:/home/TeleNature/public_html/photos del /F /Q "C:\Documents and Settings\Administrator\Desktop\ToGo\*" ================================================================== The linux shell script. #!/bin/bash HOME_DIR=~ TOGO=$HOME_DIR/ToGo BACK=$HOME_DIR/Back SERVER="telenature.ncsa.uiuc.edu" LOGIN="phototrans" DEST="/home/TeleNature/public_html/photos/" #COUNT=`ls $TOGO | wc -w` LS=`ls $TOGO` if [[ $LS != "" ]] then scp -r $TOGO/* $LOGIN@$SERVER:$DEST mv $TOGO/* $BACK/ fi --Jon Gorman last modified: 10/8/2003 version: $Revision: 1.6 $