`
wildwind
  • 浏览: 100569 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

Linux File transfer

阅读更多
More or less secure methods of transferring files.
By: Mihai Marinof, Linux Editor


When we need to download or copy a file from a remote machine to our local one or vice-versa, most of us use a plain, simple to use, FTP client. There are actually a wealth of tools available for transferring files, and some of them perform automation functions that can easily assist your business in building site mirrors, synchronizing directory contents, and more.

These lower security tools include lftp, rsync, and wget. Many of these programs can handle more than just FTP connections, and some even have their own shell-like syntax for sophisticated use.

The high security tools include scp and sftp are specially built for using in a secure manner. These are the tools you'll want to develop a habit of using when transferring information you need to keep private. You'll need to have ssh configured between the two machines in question before you can use either of these secure tools.


1.  lftp

The lftp tool can handle six different methods of file transfer (see the man page for the full list), including FTP and HTTP as well as the option of OpenSSL-based

secure methods if they were included when the program was compiled. As example, I'll show you how to grab the latest kernel version from the kernel.org FTP. Open a terminal and type:

lftp ftp.kernel.org

Cd to v2.6 releases dir:

lftp ftp.kernel.org:/> cd /pub/linux/kernel/v2.6
(just like in a normal console, you can use TAB for auto-completion)

The v2.6 directory contains, apart from the kernel releases, changelogs and paths. We are only interested to find out what is the latest full kernel package, so in the lftp prompt, type:

lftp ftp.kernel.org:/pub/linux/kernel/v2.6> ls | grep linux | more

Scroll down using enter or space until you find the latest version. Press q to exit 'more' and, to download the package, type:

lftp ftp.kernel.org:/pub/linux/kernel/v2.6> get linux-2.6.18.tar.bz2
(2.6.18 is the latest version at the time of this guide, you'll have to get whatever is the latest version in your present time)



2.  rsync

rsync comes to us from the Samba project, at http://rsync.samba.org/. This underutilized but valuable tool is excellent for keeping Web and FTP site mirrors up to date, not to mention for keeping the contents of local directories within your network in sync. You can also use it for private "secure" purposes such as data backup, as long as you are sure to utilize rsync within an ssh connection.

Say you're using Fedora Core 5 and want to grab the latest packages without using yum. Let's also say the last update was made with yum, which left all the latest update packages at that time, in its cache directory.

Begin by finding out if there are any rsync servers running on this server. The command to use for this is:

rsync carroll.cac.psu.edu::

Since what I'm interested in is Fedora Updates, I’ll now type the following to find the contents of the fedora-linux-core section:

rsync carroll.cac.psu.edu::fedora-linux-core

This command will show you the contents of the fedora section. To download everything in the updates you don't already have, use this command:

rsync -uv carroll.cac.psu.edu::fedora-linux-core/updates/5/SRPMS/* /var/cache/yum/updates-released/packages/

The -u flag tells rsync to only grab the files that I don't already have, and the -v tells rsync to be verbose and show me the name of each file as it's grabbing them rather than just showing me the server's banner and then sitting there silently while it does its work. The path at the end tells rsync where I want the files to go.



3.  wget

GNU's wget utility is a non-interactive download tool, meaning that it has no command line features to match lftp's functionality. You have access to FTP, HTTP, HTTPS, and proxied HTTP files using this program, but you have to know ahead of time what file you're trying to download, and where it is in the system's path.

To download the Google default page:

wget http://www.google.com

If there are a list of pages, files, and so on that I want to grab for the script, I can list one URL-formatted item per line within a file. For example, if the file was ~/bin/getme, I would use:

wget -i ~/bin/data/getme

I could even tell wget to grab all of the URLs listed in a particular HTML file. If the default file I downloaded from Google was index.html and it was saved in my home directory, then I would use the following to have wget grab every URL referenced in this file:

wget -i index.html -F

Notice the need to keep the flag's option with the flag. This command will not work if you use -iF .


4.  scp

scp is a secure version of the old rcp tool, that uses ssh to prevent people from sniffing out what you're transferring. How you utilize this tool depends on whether you're using the same account name on both machines, or different account names. Otherwise, if you have your ssh set up properly, this is a pretty straightforward program.

To copy the file sample1 to the recipient host example2 using scp, from the account bob on the local machine to the account bob on the remote machine, you would type:

scp sample1 example2:

However, if you wanted to copy the same file from bob on the local machine to jane on the remote machine, you would need to use a user@host format, such as:

scp sample1 jane@example2:

To use scp over a different port, you will have to use the -oPort=74 option.



5.  sftp

sftp is an interactive tool that works over an ssh connection, mirroring the ftp program's functionality—and is in fact a nice front end to scp. You won't be using this client for anonymous downloads, but if you need to move data or other confidential information between machines, this is an excellent tool to choose. Once you've mastered the scp command, you'll find sftp simple to use, or vice versa. They share many of the same flags and mostly the same syntax.

Once I have ssh set up for a proper connection on both machines, I can open the connection using:

sftp tom@example.com

After being challenged for the password for user "tom", which is transmitted in a tunnel through the secure shell, I'm in and have the sftp prompt. Now, I can use any of the commands in the sftp man page's INTERACTIVE COMMANDS section. So think of sftp as the more advanced, interactive cousin of scp.


linux transfer to windows:
1.    Samba
2.    NFS
3.    Cygwin
4.    Rsync
分享到:
评论

相关推荐

    linux-file-transfer.zip_TCP/IP LINUX FILE_linux file transfer_li

    "TCP/IP LINUX FILE"进一步强调了传输方式是基于TCP/IP协议,而"linux file transfer li"可能是"Linux文件传输工具"或"Linux文件传输教程"的简写,意味着这个压缩包提供的不仅是一个程序,还可能包括相关的指导说明...

    SSH Secure File Transfer Client,Linux文件管理,Uinux文件管理

    SSH Secure File Transfer Client是用于在Linux系统中进行安全文件传输的工具,它是Secure Shell (SSH)协议的一个实现,主要用于远程登录、文件传输以及网络服务。Linux文件管理则涉及到对操作系统中文件和目录的...

    SSH Secure File Transfer Client

    SSH Secure File Transfer Client是一款专为Windows用户设计的工具,它允许用户通过SSH(Secure Shell)协议安全地连接到Linux服务器,实现远程控制和文件传输功能。SSH是一种网络协议,用于在不安全的网络环境中...

    CC File Transfer绿色特别版

    **CC File Transfer 绿色特别版** CC File Transfer是一款专为频繁进行文件传输的用户设计的基于Web的软件。这款工具的独特之处在于它的便捷性和高效性,使得在不同计算机之间移动文件变得简单快捷,无需复杂的网络...

    Android-android-file-transfer-linux.zip

    Android-android-file-transfer-linux.zip,Android Linux文件传输,安卓系统是谷歌在2008年设计和制造的。操作系统主要写在爪哇,C和C 的核心组件。它是在linux内核之上构建的,具有安全性优势。

    ssh secure file transfer clien和ssh secure shell client

    总之,SSH Secure File Transfer Client和SSH Secure Shell Client是Linux系统管理中的核心组件,提供了安全的远程登录和文件传输功能。理解并熟练掌握这些工具及其相关概念,对于任何在远程Linux环境下工作的IT专业...

    android-file-transfer-linux:适用于Linux的Android文件传输

    如果您的发行版不提供android-file-transfer-linux软件包,您仍然可以将其安装在系统中。 有很多可用的软件包: Snapcraft: ://snapcraft.io/android-file-transfer-linux AppImage: : MacOSX DMG映像: : ...

    SSH Secure File Transfer Client+putty

    SSH Secure File Transfer Client通常指的是支持SSH协议的文件传输工具,允许用户在不同主机之间安全地移动和管理文件。 Putty是一款流行的SSH客户端,主要针对Windows用户,但它也支持其他网络协议如Telnet、...

    Android File Transfer (适用MacOS、Linux)

    Android File Transfer (适用MacOS、Linux)

    FTP(File Transfer Protocol,文件传输协议)

    为了解决这个问题,出现了FTPS(FTP over SSL/TLS)和SFTP(Secure File Transfer Protocol,基于SSH)。FTPS提供了对传输数据的加密,而SFTP则提供了更安全的环境,整个会话都在加密通道中进行。 在Linux中,...

    FileTransfer.zip

    在本项目"FileTransfer.zip"中,我们可以看到一个针对FTP文件传输实现的程序,它能够在Windows和Linux系统上运行,为学习和实践FTP提供了方便。 FTP的工作原理基于TCP/IP协议栈,通过建立控制连接和数据连接来实现...

    linux下lftp连接ftp服务器上传下载命令.docx

    LFTP(Linux File Transfer Program)是一个功能强大的 FTP 客户端程序,可以在 Linux 操作系统中使用,用于连接 FTP 服务器,上传和下载文件。LFTP 的主要特点是支持多种协议,包括 FTP、FTP over SSL/TLS、SFTP、...

    The ZMODEM Inter Application File Transfer Protocol.pdf

    10. **跨平台兼容性**:ZModem协议被广泛应用于各种操作系统和软件中,包括Unix、Linux、Windows等,这使得它成为一种通用的文件传输工具。 总结来说,ZModem协议因其高效、可靠和灵活的特性,成为了远程文件传输...

    linux-socket-file-transfer.rar_arm linux socket_linux arm pc soc

    本资源"linux-socket-file-transfer.rar"聚焦于在ARM Linux设备(例如嵌入式板卡)与传统PC之间利用Socket进行文件传输的实践代码。以下将详细介绍涉及的知识点: 1. **Socket概念**:Socket是进程间通信的一种形式...

    tcp-socket-file-transfer.rar_tcp socket linux

    在描述中提到的"tcp socket file transfer.txt"文件,可能包含了具体的代码示例或步骤指导,帮助读者理解如何实现上述过程。例如,它可能包含以下关键代码片段: ```c // 创建套接字 int server_sock = socket(AF_...

    tcp-socket-file-transfer.rar_TCP file transter_linux tcp socket_

    在"tcp socket file transfer.txt"这个文件中,可能包含了详细的代码示例,讲解了如何在Linux环境下利用TCP套接字实现文件的完整传输过程,包括客户端和服务器端的实现细节。这将帮助读者深入理解TCP套接字编程,并...

    file_transfer.rar

    综上所述,"file_transfer.rar"提供的资源涵盖了Linux环境下的C语言网络编程,特别是文件上传和下载的核心概念和技术。通过学习和实践这个项目,开发者可以深化对C/S架构、TCP/IP通信、Linux网络编程及文件操作的...

    ftp.rar_ftp_ftp 代码_linux tcp transfer_tcp传输文件_基于TCP-IP多线程文件传输

    FTP(File Transfer Protocol)是一种广泛使用的网络协议,用于在互联网上进行文件的上传和下载。本文将深入探讨FTP的工作原理,以及如何在Linux环境中使用C语言实现基于TCP/IP的FTP文件传输程序,包括客户端和...

Global site tag (gtag.js) - Google Analytics