|
||||||||||||||
|
Using Scripts or Batch files with SSH Secure Shell 3.2.0 |
|||||||||||||
| To create an automated upload or download sequence with SFTP you will first have to create a Keypair that will be responsible for the authentication process of the sequence. Once the keys have been created and placed in the appropriate location on the client machine and the server, the SFTP client will be able to authenticate and transfer files using a script. Step 1: Creating Keypairs1. Open an SSH or SFTP session to the host using the SSH Secure Shell GUI. 2. Select Edit -> Settings 3. Under Global Settings -> User Authentication -> Keys, Click Generate New 4. In the Key Generation Wizard click Next 5. The Key Type should be DSA and the Key Length should be 2048. 6.Click Next and wizard will generate public and private keys. 7. When this process is complete, click Next 8. Enter a file name for your key (Do not enter anything for Comment or Passphrase). Click Next. 9. Click Yes in the window warning "you have entered an empty passphrase" 10. Click Upload Public Key 11. Accept the defaults for Uploading Public Key and click Upload (It will create a folder called .ssh2 at the root of your home dir to store the public key) 12. Click the Finish button. 13. Click Ok on the settings window. To verify that the keys are working, disconnect from the server and reconnect. (If you didn't create a profile to the server, when you choose "Quick Connect" you will need to change the authentication method to "Public Key". Your client should login using the public and private keys, bypassing your password. Note: Because your private key is not protected with a passphrase it is important that the key reside in a secured directory on you local machine. Step 2: Creating the SSH script and batch files (example)1. Create a directory on spot (or your server) called test 2. Create a directory on your local machine called C:\ssh2test 3. Create a file called test.txt in C:\ssh2test\ 4. Create a file called up.txt in C:\ssh2test\ 5. Put the following lines in up.txt
6. Create a bat file called go.bat in C:\ssh2test\ 7. Put the following line in go.bat
8. Now run go (from the command prompt). You should see an output like the following.
The ftp script commands you want to run should be placed in up.txt The "-B" flag allows you to specify a scripted file for sftp.
Get HelpTo get help contact the IT Service Center by phone at 303-735-HELP (5-4357 from an on-campus phone), by e-mail at help@colorado.edu, or in person at the IT Service Center walk-in (located two buildings east of the UMC). Encrypted Authentication ProjectEncrypted Authentication Project homepage
|
|
||||||||||||
| Support | | | Training | | | Facilities | | | About ITS | | | ITS Home | |||
|
|||||||||||