Solved

Copying File to Another Server/Host

Posted on 2008-10-30
5
269 Views
Last Modified: 2010-04-21
Ok part xxx? (I forget) of a job I was clueless of before starting.

http://www.experts-exchange.com/Database/MySQL/Q_23746849.html
http://www.experts-exchange.com/Database/MySQL/Q_23834886.html
http://www.experts-exchange.com/Database/MySQL/Q_23850836.html
http://www.experts-exchange.com/Database/MySQL/Q_23854456.html
http://www.experts-exchange.com/Database/MySQL/Q_23855516.html
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23861816.html


I gave away alot of points recently.

Ok now I need to send a file from one server to another. I have a dump file on my local company server that I need to copy onto the web server, then run it.

I thought maybe I could use ssh/scp but I realize that is not possible because it prompts for a password. Then I found I could use a key to copy it. But I also see that it can be done other ways.

I am very unfamiliar with these commands and not sure which is the best method, or how to write it.

I have PHP available or run commands by Cron Jobs. Or maybe someone can recommend a better way. I'm open to anyway that works.

Thanks.
0
Comment
Question by:SaltyDawg
  • 3
  • 2
5 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Do you have an account on the other server?  If so, contact the administrator for help with FTP.
0
 
LVL 1

Author Comment

by:SaltyDawg
Comment Utility
I do have an account, would ftp allow me to do it automatically? Say I wanted to run the script at midnight each day to copy the file to the other server?
0
 
LVL 1

Author Comment

by:SaltyDawg
Comment Utility
I followed this instruction for creating a public key.

----------------------
ssh-keygen -t rsa


#

In response, you should see:

Generating public/private rsa key pair
Enter file in which to save the key ...


Press Enter to accept this.
#

In response, you should see:

Enter passphrase (empty for no passphrase):


You don't need a passphrase, so press Enter twice.
#

In response, you should see:

Your identification has been saved in ...
Your public key has been saved in ...


Note the name and location of the public key just generated. It always ends in .pub.
#

Copy the public key just generated to all of your remote Linux boxes. You can use scp or FTP or whatever

to make the copy. Assuming you're using root--again, see my warning in step 1--the key must be contained

in the file /root/.ssh/authorized_keys. Or, if you are logging in as a user, for example, clyde, it

would be in /home/clyde/authorized_keys. Notice that the authorized_keys file can contain keys from

other PCs. So, if the file already exists and contains text, you need to append the contents of your

public key file to what already is there.
--------------------------------------------

Your identification has been saved in /home/me/.ssh/id_rsa.
Your public key has been saved in /home/me/.ssh/id_rsa.pub.

but when I attempt to copy it with:
scp id_rsa.pub usr@myhost:ebk

it say no file or directory

Am I doing something wrong
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
Sure - there aer ways to automate FTP.  One way would be a cron job.

Sorry, I can' t follow that public key stuff.  You would probably want a password-protected login anyway if you're using FTP or something like it to transfer stuff into your site.
0
 
LVL 1

Author Closing Comment

by:SaltyDawg
Comment Utility
tahank
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now