Ssh to get files from server A and zip in server B


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Ssh to get files from server A and zip in server B
# 1  
Old 07-01-2013
Network Ssh to get files from server A and zip in server B

Hi,

I have read & write access in Unix box A and read access in Unix box B.
I want a folder to be zipped from box B and sftp-ed in box A.

Is there a remote scripting to achieve this?
# 2  
Old 07-01-2013
Quote:
Originally Posted by Prasannag87
Is there a remote scripting to achieve this?
Yes, there is: you can use the "ssh" command to execute commands remotely:

Code:
userA@hostA> ssh userB@hostB "some-command"

willl, when issued as userA on hostA, run "some-command" on hostB as userB. You might want to use "scp" instead of "sftp", but that is rather a matter of taste.

I hope this helps.

bakunin
# 3  
Old 07-01-2013
Code:
ssh me@boxB ' tar cf -  ./some/directory | ssh me@boxA ' | cat - | zip ./mytar.tar.zip -) '

IF you do not have ssh keys this will ask for passwords: once for boxB then again for boxA

Last edited by jim mcnamara; 07-01-2013 at 12:11 PM.. Reason: typo
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

How to ssh from an AIX OS server to a Fabric OS server without password?

Hi I'd like to ssh from an AIX OS server ( v5.3) to a Fabric OS server ( v6.1.2 ) without password. I tried using dsa or rsa keys but it didn't work, the aix server still asked for the password. Somebody help, please :(:(:( (8 Replies)
Discussion started by: bobochacha29
8 Replies

2. Shell Programming and Scripting

Multi server access through remote server using ssh

Team, Presently I have 5 ip address kept in ip_abc1 file, for each of the ip address listed, i need to login on each ipaddress one at a time and login as below for that specific ip address ssh -p 8101 karaf@<ip.address_for the specific ip address as logged in> password features:list... (4 Replies)
Discussion started by: whizkidash
4 Replies

3. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

4. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

5. Shell Programming and Scripting

KSH fetching files from server A onto server B and putting on server C

Dear Friends, Sorry for this basic request. But I just started learning Ksh recently and still I am a newbie in this field. Q: I have files on one server and the date format is 20121001000009_224625.in which has year (yyyy) month (mm) and date (dd). I have these files on server A. The task... (8 Replies)
Discussion started by: BrownBob
8 Replies

6. UNIX for Dummies Questions & Answers

compare zip files from a local to remote server

Good evening I need your help pease I know there are 2 commands(diff, or cp) to compare files in a directory. but the question arises: 1. can i compare zip files or ive got to unzip them? 2. how can i compare 2 files from a local to a remote server? (is there any special commad or ive got... (4 Replies)
Discussion started by: alexcol
4 Replies

7. Shell Programming and Scripting

script for to take files from FTP server to UNIX server and Unzipped that files

script for to take files from FTP server to UNIX server and Unzipped that files (1 Reply)
Discussion started by: sunilamarnadh
1 Replies

8. UNIX for Dummies Questions & Answers

Long listing of files using find command on remote server via SSH

Hi , I am trying to find some files on a remote machine using the find command. >ssh -q atukuri@remotehostname find /home/atukuri/ -name abc.txt /home/atukuri/abc.txt The above command works fine and lists the file, but if I want to do a long listing of files (ls -l) its not working . ... (2 Replies)
Discussion started by: atukuri
2 Replies

9. UNIX for Dummies Questions & Answers

Copying files from laptop to remote server using SSH

Hello, I'm sorry if this sounds like a very simple question, but I'm having some difficulty with it being a complete newbie to UNIx. I use Windows, and always have, but need some UNIX access for work, picking up files from our group space, etc. Basically, I'm using Cygwin and can SSH into the... (3 Replies)
Discussion started by: patwa
3 Replies

10. Shell Programming and Scripting

How to uncompress zip files in a remote server from a script

Hi UNIX gurus, the scenario is that i have written a script which takes as input a directory structure. And after that a tar is made ,then zipped and FTP it to a server.But how do i uncompress it from my script as FTP doesnot support any uncompress command during FTP session. I have to automate... (2 Replies)
Discussion started by: rahul26
2 Replies
Login or Register to Ask a Question