Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-08-2004, 11:51 AM   #1
LQ Newbie
Registered: Jun 2004
Location: nepal
Posts: 26

Rep: Reputation: 15
trying to copy files from another machine to the local machine using telnet,

Is it possible to copy files from a remote host to the local host using telnet? If yes, how?

Old 06-08-2004, 12:12 PM   #2
Senior Member
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
Don't know about doing it with telnet because I've never used it. You really shouldn't either... It sends everything, including your login/password, across the network as plain text. Not even a thought of security.

Instead, you should use ssh (Secure SHell) to remotely login. When you have that running, you can then use scp (Secure CoPy) to transfer files...

$ scp user@from_computer:dir/filename user@to_computer:dir/filename

I know there's a similar rcp (Remote CoPy), but I'd guess it's not too secure.
Old 06-09-2004, 02:19 AM   #3
Registered: Sep 2003
Location: Pune, India
Distribution: Red Hat
Posts: 106

Rep: Reputation: 15
No as far as i know. You will have to either use ftp or scp for that. See the related man pages for more information.
Old 06-09-2004, 02:29 AM   #4
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
actually scp only supports local-to-remote or remote-to-local transfers... if you have to go remote->remote with scp, ssh into one box (if scp is listening, ssh must be as well) and scp from that box to the other. IE:

ssh box1
username: me
password: bunk

scp ./foo me@box2:~


Old 03-14-2006, 08:13 AM   #5
LQ Newbie
Registered: Feb 2004
Location: Western NC
Distribution: RH 5.2, 7.3, Fedora, Gentoo
Posts: 15

Rep: Reputation: 0
system1 @
system2 @

on system1: /etc/exports = /myexport *(rw,no_root_squash)
export exports
on system2: mount /mnt/remote
move files to system1 by: cp /someexport/thatfile /mnt/remote

if you want to transfers files back: cd /local_directory
cp /mnt/remote/that_other_file .

if you want to copy from system1 to 2 just create an export on system2 and then use the appropriate command.
Old 03-14-2006, 04:06 PM   #6
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
You may use netcat, see nc(1)

It's easy, once you connect (with either ssh or telnet), you open a port in any machine with nc, then you use nc on the other to transfer data. The choice of machine depends on your configuration, firewalls, etc.

For example, to open a port in any machine and redirect output to a file, you'd do:

nc -l 40000 | bunzip2 -c > myfile

Then, to transfer it, you'd do:

cat myfile | bzip2 -c | nc $IP 40000
Old 03-14-2006, 04:45 PM   #7
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint
Posts: 9,707

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
If you really have no other option than using telnet, you can still download files through it.

If they are plain text files, run the "script" command before launching the telnet command, on the remote host "cat" your text file then logout.
After exiting the script command, you'll have a file named "typescript" that will contain all your telnet transaction, just edit this file by removing the unnecessary header, trailers and the carriage returns at each end of line and you are set.

If you want to to transfer a binary file, use the same technique, but instead of using cat, use:
uuencode -m filename < filename

On the local host, use uudecode to process the typescript, it will extract the binary file.

Last edited by jlliagre; 03-14-2006 at 04:49 PM.


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
copy files from telnet session to local drive rkemp Linux - Networking 7 03-11-2009 05:01 AM
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 12:23 PM
how to open a dilog on local machine when i do ssh to remote machine fahad26 Programming 3 05-03-2005 07:39 PM
client can't copy files to local machine through vsftpd server on RH9 tree_buddy Linux - Networking 7 09-15-2003 10:54 AM
Using SMB to copy files from one linux machine to second linux machine. coppersky Linux - Networking 9 06-24-2003 12:07 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:32 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