LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-13-2008, 03:35 AM   #1
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Rep: Reputation: 30
how to transfer a file between 2 servers


Hello

suppose I have a file.txt on server A (suppose it's a linux server) .

Which is the best , faster and safer way to transfer file.txt from server A to server B ?

Thank you
 
Old 08-13-2008, 03:39 AM   #2
Rupertt
LQ Newbie
 
Registered: May 2007
Posts: 20

Rep: Reputation: 0
scp filea.txt user@target:/path/to/targetfolder
 
Old 08-13-2008, 04:04 AM   #3
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Rupertt View Post
scp filea.txt user@target:/path/to/targetfolder
Thank you , but how to enter the remote password in the command above (to avoid the prompt)
 
Old 08-13-2008, 04:09 AM   #4
Rupertt
LQ Newbie
 
Registered: May 2007
Posts: 20

Rep: Reputation: 0
you cant, you have to login to server a and execute the command, then scp asks you for the password of server b
 
Old 08-13-2008, 04:12 AM   #5
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Rupertt View Post
you cant, you have to login to server a and execute the command, then scp asks you for the password of server b
In this case it's no good because I would use the command inside a php or perl script .
 
Old 08-13-2008, 04:31 AM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Does scp use ssh keys if they are in place? I'd give that a go first. Otherwise, you can use rsync.
 
Old 08-13-2008, 04:37 AM   #7
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
You have to use ssh keys then.

Yves.
 
Old 08-13-2008, 04:51 AM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Not with rsync
 
Old 08-13-2008, 05:15 AM   #9
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by billymayday View Post
Not with rsync


ok I am trying to use rsync but ..

how to enter/set the remote password in the command below ?

# rsync -v -e ssh test.txt 12749292@mydomain.com:~

and how to avoid/skip with a "yes" this/following warning ?

The authenticity of host 'mydomain.com (14.4.12.30)' can't be established.
RSA key fingerprint is c2:65:d5:57:af:95:11:ec:87:d6:35:a0:8b:99:a1:70.
Are you sure you want to continue connecting (yes/no)?


Thank you

Last edited by graziano1968; 08-13-2008 at 05:17 AM.
 
Old 08-13-2008, 05:22 AM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You only get that warning the first time you attach

See --password-file option

Last edited by billymayday; 08-13-2008 at 05:25 AM.
 
Old 08-13-2008, 05:27 AM   #11
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by billymayday View Post
You only get that warning the first time you attach

See --password-file option

the problem is that I need to avoid the warning always (also for the first time) because I should send the command with a php script. And for my purpouse the --password-file is not safe at all. I wish to put the password inside an encrypted php file (inluded with the command , but as it seems also rsync does not permit it, damn !).

Last edited by graziano1968; 08-13-2008 at 05:29 AM.
 
Old 08-13-2008, 06:27 AM   #12
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Have a look at "man rsyncd.conf". I'm pretty sure that if you define a module along the lines:

Code:
[data]
        path = /data
        use chroot = no
        read only = no
        uid = some_user
        gid = some_group
rsync will allow password-less connections (I can't connect to the server I have that does this at the moment)
 
Old 08-13-2008, 06:37 AM   #13
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
You can create a passord-less setup with keys on a given remote user (let's say REMOTE_USER) and then use rsync this way:

rsync -e 'ssh -x -l REMOTE_USER' …other options…

I actually use this command on a daily basis without any password:
rsync -rzlpt --ignore-errors --delete --max-size=3M -e "ssh -x -l remote_me" "server:/important/place" "/local/backup"

Yves.
 
Old 08-13-2008, 07:01 AM   #14
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by theYinYeti View Post
You can create a passord-less setup with keys on a given remote user (let's say REMOTE_USER) and then use rsync this way:

rsync -e 'ssh -x -l REMOTE_USER' …other options…

I actually use this command on a daily basis without any password:
rsync -rzlpt --ignore-errors --delete --max-size=3M -e "ssh -x -l remote_me" "server:/important/place" "/local/backup"

Yves.

I never used ssh key , could you be more detailed (I'm lost)?
 
Old 08-13-2008, 04:08 PM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
man ssh-keygen is a pretty complete guide
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file time stamp is wrong with ssh file transfer cy163 Linux - Newbie 8 05-18-2008 01:40 AM
How to measure data Transfer beween two servers. rajaniyer123 Solaris / OpenSolaris 5 06-05-2007 03:41 PM
Quick way to transfer files using modems without servers detly Linux - Networking 3 07-07-2005 11:17 PM
Transfer Servers biggdady6998 Linux - General 3 10-02-2003 05:55 PM
transfer DNS data to secondary name servers? Grum Linux - General 0 05-15-2002 03:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration