nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Linux UNIX SFTP in a Shell Script

This is a discussion on Linux UNIX SFTP in a Shell Script within the Shell scripting forums, part of the Development/Scripting category; Hello, Here i have a use case........... I have some 3 different host machines with different instancesin each host(For eg. ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-29-2008, 03:09 PM
Junior Member
User
 
Join Date: Jan 2008
My distro: Debian
Posts: 3
Rep Power: 0
Nishanthhampali is on a distinguished road
Default Linux UNIX SFTP in a Shell Script

Hello,
Here i have a use case........... I have some 3 different host machines with different instancesin each host(For eg. 3 instance in each host).In each instance i have the log files......... I have to copy all the log files from all the instances of hosts and store it in temporary directory or as a single file using sftp...........
please let me know how i can do this scripting............ I am new to this shell scripting..........
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-30-2008, 01:16 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 973
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

1) Generate public / private keys to do passwordless login
Howto Linux / UNIX setup SSH with DSA public key authentication (password less login)

2) Write script as follows
Code:
#!/bin/bash
scp user@server1:/path/to/file /path/to/local 
scp user@server2:/path/to/file /path/to/local 
scp user@server3:/path/to/file /path/to/local
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
SSH - Passing Unix login passwords through shell scripts arulkumarr Shell scripting 4 08-27-2008 09:22 PM
unix shell on windows xp chiku Solaris/OpenSolaris 4 03-07-2008 03:17 PM
Linux Shell script to mount remote windows share angelus_kit Shell scripting 2 09-06-2007 07:18 PM
SCP with a bash shell password linux and unix servers jerry Networking, Firewalls and Security 1 06-09-2007 05:53 PM
How to get free shell Linux and UNIX account for friends jerry Shell scripting 0 06-09-2007 01:57 AM


All times are GMT +5.5. The time now is 04:36 AM.


Powered by vBulletin® Version 3.7.3 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36