Link to home
Start Free TrialLog in
Avatar of bkreynolds48
bkreynolds48

asked on

tar some files on a linux system from a remote unix system and ftp them to the unix system

I want to run tar on a linux system from a SUN Solaris 10 system to tar up a file system and then ftp the tar file to the unix system.  My problem is that I am not the only one using the linux system as root.  I keep putting the tar and ftp in the root cron on the linux system but it keeps getting deleted so I need to figure out a way to run this from my unix system where no one else logs on.  I thought I could use rsh but have never used it before and am not sure what needs to be setup.  I am a bit reluctant to put a .rhost file on this linux system but cannot figure out another way to do the tar and ftp.  I can't change the way the linux system files are setup as they are production and as I said used by others.

Any ideas or suggestions would be really appreciated.

Thanks
Avatar of wwnosal
wwnosal

You could try to pipe all the commands for creating the tar and sending via ssh, from your Solaris however I'm not sure if it's good idea. Thats just a quick thought.
Avatar of awa2008
Hello ,

you can found a lot site explain that on typing in google : tar over ssh

http://www.hostinggeek.com/2005/08/tar-over-ssh.html
http://todbot.com/blog/2005/06/26/ssh-and-tar-thru-ssh-gateway/

http://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/





Using this method effectively sends the compressed tarball to the terminal. You then pipe that into an ssh session which is running the extract version of the previous tar function along with the change directory argument. This, essentially, sends the compressed tarball into a decompression process at the other end over a secure ssh "pipe".

The result is a pretty quick file transfer which - as the data is being sent in a compressed GZIP form (of BZip2 if you replace the z with a j in the tar functions) you save on bandwidth too.

Here an an example of how to do this, assuming you are in (for example) /var/www/html/ and the website you want to transfer is the folder www.example.com.

tar czf - www.example.com/ | ssh joebloggs@otherserver.com tar xzf - -C ~/

This will send the entire www.example.com folder over to the home folder on your target server in compressed form over and encrypted connection.


from : http://www.thingy-ma-jig.co.uk/blog/03-09-2008/using-tar-and-ssh-improve-scp-speeds

Regards
Avatar of bkreynolds48

ASKER

Can I script using ssh?  How would I enter a password?
I have a file setup on the linux system to run the tar.
I just need to execute that from the unix system.
Is that possible with ssh?
You can you key file for ssh, then you won't need a password

SOLUTION
Avatar of wwnosal
wwnosal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you can generate key file by ssh-keygen (see man on how to do this)
thanks
You can use pass phraseless keys use the SSH_ASKPASS variable. Google "ssh paraphraseless" or "ssh_askpass" for plenty of examples.