Linux - NewbieThis 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!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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
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.
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
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.