两台Linux机器之间的Telnet文件传输
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15807122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Telnet File Transfer between two linux machines
提问by Rajeev Das
I want to send a file from one Linux machine with IP suppose "192.168.2.25" to other Linux machine that's a server "192.168.2.110"
我想从一台具有 IP 的 Linux 机器发送一个文件,假设为“192.168.2.25”到另一台作为服务器“192.168.2.110”的 Linux 机器
how can i do that by using Telnet command??
我怎样才能通过使用 Telnet 命令来做到这一点?
回答by parkydr
Telnet just gives you a remote terminal session. The best you could do is telnet, open a new file in an editor and copy/paste the text from the local machine.
Telnet 只是给你一个远程终端会话。您能做的最好的事情是 telnet,在编辑器中打开一个新文件,然后从本地机器复制/粘贴文本。
To copy files use something like rsync, scp, rcp or ftp.
要复制文件,请使用 rsync、scp、rcp 或 ftp 之类的东西。
回答by Keith Morgan
A simple option is to use netcat (nc). This is particularly useful on stripped down Linux systems where services like ssh and ftp are turned off.
一个简单的选择是使用 netcat (nc)。这对于关闭 ssh 和 ftp 等服务的精简 Linux 系统特别有用。
On destination machine run the following command: nc -l -p 1234 > out.file
在目标机器上运行以下命令: nc -l -p 1234 > out.file
On source machine run the following command: nc -w 3 <dest-ip-adr> 1234 < out.file
在源机器上运行以下命令: nc -w 3 <dest-ip-adr> 1234 < out.file
For more details look, for example, here.
例如,有关更多详细信息,请查看此处。
There are also netcat implementations for Windows, e.g. ncat.
也有适用于 Windows 的 netcat 实现,例如ncat。
回答by Hrvoje
I was able to do it by using the following command:
我能够通过使用以下命令来做到这一点:
scp mylocalfile.txt [email protected]:/recipient/directory/
I hope this helps. Drew Morris expalined it in more details.
我希望这有帮助。 德鲁·莫里斯 (Drew Morris) 对此进行了更详细的解释。
回答by Ira Woodring
While it may not be possible with only telnet, it is possible with telnet and netcat. Some of the examples above just referenced using netcat, but there have been times when I was on an old machine that was still in production that had telnet but not netcat. In this case, you can set netcat to listen on a newer, remote machine and telnet the file to it.
虽然仅使用 telnet 可能无法实现,但使用 telnet 和 netcat 是可能的。上面的一些示例只是使用 netcat 引用,但有时我在一台仍在生产的旧机器上使用 telnet 但没有 netcat。在这种情况下,您可以将 netcat 设置为在较新的远程机器上侦听并将文件 telnet 到它。
On the newer remote machine:
在较新的远程机器上:
netcat -l <PORT> > OUTPUT.FILE
On the older telnet only machine:
在仅支持 telnet 的旧机器上:
cat FILE | telnet REMOTE-HOST PORT
Note that this works with text files. If you have a binary file of some sort you would need to do further manipulation on both ends.
请注意,这适用于文本文件。如果您有某种二进制文件,则需要在两端进行进一步操作。