Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When all you have is a serial console (say via telnet through a terminal server), what methods can be used to transfer files in/out of a host?

Cut/paste works for the small/printable stuff and I've played with a combination of uuencode/uudecode (with gzip) handle the unprintable but it's all very limiting.

share|improve this question
    
Given some of the comments you've left about availability of utilities, it would help if you could name the platform and/or outline the environment you're in. Otherwise, you're going to get the stock Kermit/XMODEM/YMODEM/ZMODEMk via terminal answers... –  Avery Payne Aug 12 '10 at 17:11
    
I spend most of my day behind Solaris box. So in those terms, if all you had was SUNCreq (or perhaps SUNWCuser) what would you the answer? –  Stephen Paul Lesniewski Aug 12 '10 at 17:51
add comment

4 Answers

have you tried minicom file transfer?

share|improve this answer
    
Doesn't this require something like 'sx' or 'sz' on the source host? –  Stephen Paul Lesniewski Aug 11 '10 at 17:19
4  
Nope, minicom handles its own file xfers. sx,sy,sz and rx,ry,rz are separate programs, usually found in packages aptly named lszrz or something. Though I would suggest using sz and rz. Small, simple and it does what it does. Minicom is a whole terminal emulator. –  reiche Aug 11 '10 at 17:34
    
This answer is not correct. Minicom spawns lrzsz for file transfers. Minicom can not and does not handle it's own file transfers. –  Jonathan Cline IEEE Sep 2 '11 at 17:50
add comment

Most of the serial console programs (minicom, HyperTerm, VanDyke CRT...) you'll use on the other end of the connection will have Zmodem support, and most Linux boxes have the lrzsz package installed on them already. If not, lrzsz is small enough that you could bootstrap the process with one of the other recommended methods. You could ASCII-upload the sources, either as C text files, or a uuencoded tarball.

Once you have Zmodem on both ends, just type rz to start the receive on the Linux box.

One of the nice things about Zmodem, relative to other alternatives mentioned like nc or kermit, is that it sends out a unique string that the serial console program on the other end recognizes as its cue to start a Zmodem send. You usually get a file picker dialog at this point, letting you choose the file(s) to upload.

Other nice things about Zmodem are the ability to transfer multiple files at once, automatic resume if a transfer aborts, etc.

share|improve this answer
    
Fantastic, I was hoping this question had an answer mentioning kermit! +1 ;) –  Tim Jun 15 '12 at 14:44
add comment

Don't know if this would work if all you had was a serial console, but if you have network access at all, then you could use nc(1) to copy files using TCP/IP.

# WARNING: Depending on your setup, this could make your system unbootable
root@destination-box.local # nc -l 8675 | dd of=/dev/sda1
root@source-box.local # dd if=/dev/sdb1 | nc destination-box.local 8675

In the above example, I cloned sdb1 from a source box to sda1 of the destination box. My choice of 8675 for a TCP port number was arbitrary; you could use any port you have access to. And it doesn't have to be a device; it can be any file.

kevin@destination-box.local $ nc -l 12345 >> ~/.ssh/authorized_keys
kevin@source-box.local $ cat ~/.ssh/id_rsa.pub | nc destination-box.local 12345

In the second example, I copied my rsa public key(~/.ssh/id_rsa.pub) and added it to the authorized keys file for the target host.

share|improve this answer
1  
Might I suggest a big red warning sign above your first idea? Some lonely soul with the heart to learn might execute something like that in the hopes of copying just files, without reading the following paragraph first of course :) –  reiche Aug 11 '10 at 17:36
add comment

I would use kermit, the grandparent of filetransfer programs. We used that already long before there was Linux.

share|improve this answer
    
ahh yes.. I remember doing that but in this case kermit isn't install on the source host. –  Stephen Paul Lesniewski Aug 11 '10 at 17:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.