Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-10-2009, 01:05 AM   #1
Registered: Jan 2008
Posts: 258

Rep: Reputation: 30
ftp vs ssh

I have two servers , there are many many files need to transfer between them ,the file size is small ( all files under 100KB ) , the files will be copy to remote server time by time I would like to write a script to do transfer file , can advise what method ( ftp or ssh ) that I should use , which one is more accurately , which one is more easy to control in my case ? thx
Old 09-10-2009, 01:27 AM   #2
LQ Newbie
Registered: Jul 2005
Posts: 15

Rep: Reputation: 0

Use ssh as it transmits the password in encrypted format not in clear text .or if u want to use ftp u can use it through SSN.
Old 09-10-2009, 02:00 AM   #3
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
SSH and FTP are two completely different things, SSH is Secure SHell a remote shell protocol with security features and encryption where FTP is File Transfer Protocol used to transfer files between two machines.

I think you mean SCP (Secure CoPy) vs. FTP in which case SCP is easily the more secure of the two, their is also SFTP What is in essence FTP over an SSH tunnel and FTPS what is FTP using SSL (similar to HTTPS). SCP is secured with the same encryption as SCP is packaged into the openSSH Daemon.
Old 09-10-2009, 02:10 AM   #4
Registered: Jan 2008
Posts: 258

Original Poster
Rep: Reputation: 30
thx reply,

the secure issue is not import in my case , as the data is not important , please ignore the security issure .

What I want to concern is the accurate and easy to manage / control , the ftp seems not easy to write a script to check the accurancy , but ssh can use chksum to check the accurancy of data , as the network between these servers is not stable , sometimes the files is missing to transfer to remote server , so I have to write script to check the accurancy , any transfer method is no problem for me , what one method is better for me ? thx
Old 09-10-2009, 02:16 AM   #5
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Unless these machines sit physically in the same network then it should be a huge issue of security, FTP is terribly bad at handling passwords and usernames. And unless you heavily lock down the accounts you are using for FTP your infact leaving the entire server open, not just the data your transferring.

As for scripts I am fairly sure you can do scripts for either of them, You can always generate a checksum on the first machine prior to transfer, send the checksum and compare it on the second in a script~.

Last edited by r3sistance; 09-10-2009 at 02:18 AM.
Old 09-10-2009, 08:12 AM   #6
Registered: Feb 2009
Distribution: Debian, CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 208

Rep: Reputation: 46
If security is not an issue (ex: both exist on a closed network or in a VPN), then both are pretty much equal. scp and ftp are both easy enough to build into a script if needed. Some ftp clients aren't very easy to script, but ncftp is (because you can put login and password into the command line and can point at specific files). And, there are probably others.

The only thing that might still be an issue is connection. Ftp has the ability to resume a file transfer if a connection drops. I don't know of a similar option in scp. But, in either case, making an md5 checksum of the files and then checking them on the other side is a good idea. I believe both do a very good job of error checking, but an outside way to verify it is better if you need to be certain that they are exact copies.

Last edited by nuwen52; 09-10-2009 at 11:10 AM. Reason: Edited for clarification on ncftp
Old 09-10-2009, 09:32 AM   #7
Senior Member
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,125
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
you might want to use rsync over ssh, it'll do retries and verify the data transfer and you get the security as a bonus
Old 09-10-2009, 10:08 AM   #8
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,143

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
scp does not prompt for anything (it is designed to be used in scripts. i.e.- non-interactive).
- look into setting up ssh keys.

s/ftp prompts the user for server name, user name, password, ... and will wait until user has entered in all feilds.
- it is designed to be interactive and more intuitive for users.
- but this is quite tedious for many hundreds of files.

also, i think ftp will be deprecated soon in favor of scp/ sftp (both work over ssh).
my opinion sftp is for humans and scp is for machines (scripts).

Last edited by schneidz; 09-10-2009 at 10:11 AM.
Old 09-10-2009, 10:42 AM   #9
Registered: Jul 2007
Posts: 72

Rep: Reputation: 16
I have used rsync for a similar kind of activity before and I think thats the most ideal for your requirement.
Give it a try.
man rsync
Old 09-10-2009, 06:19 PM   #10
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,396

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
I'd go with rsync using the ssh protocol. As said above, it'll handle the flakey cxn, because it automatically compares the src & tgt (chksums) each time and only txmits the differences. You also get the security as a free bonus.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ftp over ssh tunnel; ftp refuses to work jakykong Linux - Networking 16 10-16-2011 07:34 AM
ftp within SSH DJOtaku Linux - Software 1 03-13-2005 08:34 PM
SSH and FTP quozt Linux - Networking 4 08-22-2003 07:10 AM
FTP and SSH Ikik Linux - Networking 10 08-20-2003 10:55 AM
ssh and ftp artman62 Linux - Networking 4 08-25-2002 04:55 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 AM.

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