Link to home
Start Free TrialLog in
Avatar of SaltyDawg
SaltyDawgFlag for United States of America

asked on

Copying File to Another Server/Host

Ok part xxx? (I forget) of a job I was clueless of before starting.

https://www.experts-exchange.com/questions/23746849/Sync-MySQL-Servers-from-2-different-locations.html
https://www.experts-exchange.com/questions/23834886/Exectue-mySQL-file-by-command-line-located-on-web-server.html
https://www.experts-exchange.com/questions/23850836/ssh-connection-to-another-linux-server-webserver.html
https://www.experts-exchange.com/questions/23854456/Updating-tables-between-two-databases.html
https://www.experts-exchange.com/questions/23855516/MySQL-3-23-58-Synchronization-requires-the-table-to-have-indexes.html
https://www.experts-exchange.com/questions/23861816/Use-System-Function-to-execute-a-mysqldump.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.
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Do you have an account on the other server?  If so, contact the administrator for help with FTP.
Avatar of SaltyDawg

ASKER

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?
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
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

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
tahank