0

I have a Windows 7 machine which is connected to a linux prototyping board over a serial connection.

Now, I want to transfer files to Linux from Windows. The Linux machine does not have an additional network connection except for serial and the programs rz, sz, screen and tmux are not installed. Moreover, the serial python lib is also not installed.

Now I thought I could open PuTTY on Windows, connect to the Linux machine. Then run nohup cat /dev/ttyMDF2 > receiving-file and then close PuTTY on Windows to open the serial port up for connection again. Then run copy test.file /B COM4: /B on the Windows machine to send the file. Unfortunately, the file stays empty on the Linux machine.

How can I successfully transfer files to my Linux machine over a serial connection?

Thank you!

migrated from serverfault.com Apr 8 '17 at 10:32

This question came from our site for system and network administrators.

  • superuser.com/questions/278483/file-transfer-over-a-serial-line Teraterm, for instance, supports multiple transfer protocols. – Andrew Domaszek Mar 8 '17 at 13:51
  • yes, however the problem is that the Linux machine does not have kermit z/x/y modem installed and thus does not support receiving files using those protocols. – replax Mar 8 '17 at 13:59
  • What programs are installed? Is there a compiler on the linux system? – thrig Mar 8 '17 at 15:43
  • yes, gcc is installed – replax Mar 8 '17 at 16:15
  • Have you thought about using a memory stick or external hard drive? – Ed Heal Apr 8 '17 at 10:51
0

For a small text file, cat > somefile and use the terminal's paste functionality to drop the file in. Hit ^D at the end.

For binary files, you probably want to base64 encode it first, then decode on the remote with base64 -d somefile.encoded > somefile. Assuming you have base64. You'll have to do the encoding on the Windows side in some way.

For larger files, pasting to the terminal might not work, so you'll need something meant for reading files. Putty doesn't seem to have a function for dumping a file on the connection, some other terminal program might have. Though the command line tool plink, which comes with Putty, has the -m option to read "commands" from a file. It seems to work here. With this foo.txt:

cat > foo.out <<EOF
adsf
EOF

Running plink -m foo.txt itvirta@somehost created the file nicely. (Over SSH, but there shouldn't be a reason why a serial connection would be different.) With base64, you could skip the cat:

base64 -d <<EOF > outputfile
(base64 encoded data...)
EOF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy