Bookmark and Share

Recent Posts

Saved by uuencode (yes, uuencode)

August 08, 2017

I'd honestly forgotten about uuencode until recently, when I actually needed it:

Uuencoding is a form of binary-to-text encoding that originated in the Unix programs uuencode and uudecode written by Mary Ann Horton at UC Berkeley in 1980, for encoding binary data for transmission in email systems.

The name "uuencoding" is derived from "Unix-to-Unix encoding"; i.e. the idea of using a safe encoding to transfer Unix files from one Unix system to another Unix system but without guarantee that the intervening links would all be Unix systems. Since an email message might be forwarded through or to computers with different character sets or through transports which are not 8-bit clean, or handled by programs that are not 8-bit clean; forwarding a binary file via email might cause it to be corrupted. By encoding such data into a character subset common to most character sets, the encoded form of such data files was unlikely to be "translated" or corrupted, and would thus arrive intact and unchanged at the destination. The program uudecode reverses the effect of uuencode, recreating the original binary file exactly. uuencode/decode became popular for sending binary (and especially compressed) files by e-mail and posting to Usenet newsgroups, etc.

It has now been largely replaced by MIME and yEnc. With MIME, files that might have been uuencoded are instead transferred with base64 encoding.

I was working with IBM Support, trying to troubleshoot a server that didn't have a working network connection. It was connected to the HMC, and I could create a console. IBM wanted me to take a snap and send it to them. Taking the snap was easy, but how could I send it without a network connection? uuencode to the rescue.

IBM gave me these steps:

    #snap -r
    #snap -ac
    Use putty to ssh into the HMC as hscroot.
    Select the managed server and the lpar.
    Login as root.
    Left-click on the putty window top left corner icon.
    Select change settings.
    Go to logging and check "All session output."
    Click on browse to locate where the file will reside locally (in this case, on my laptop).
    Go back to the LPAR and run:

    #uuencode /tmp/ibmsupt/snap.pax.Z /tmp/snap

At this point, the file was "uuencoded," and these characters scrolled over my screen (and were also logged to the file I'd specified):


I then sent the file to IBM and let them handle the decoding, but it's easy enough to do it yourself. I opened the file with vi and removed some garbage at the beginning that was a result of logging everything with putty. My cleaned-up version started with:

    begin 600 /tmp/snap

I renamed it so it ended with a .uue extension. Then I opened the file using 7zip on a Windows machine. Alternatively you could move the file somewhere where uudecode is installed and decode it that way.

The point is that not having network access doesn't mean you can't move files around. If you can at least get to the console, you can still transfer files.

Ultimately, I was able to get IBM the information they needed. But let's get back to uuencode. It's mentioned in these tips and tricks:

63. How do you send an attachment via mail from AIX?

Uuencode is the answer:
uuencode [source-file] [filename].b64 mail -v -s "subject" [email-address]

For example:
# uuencode /etc/motd motd.b64 mail -v -s "Message of the day"
I use the .b64 extension which gets recognized by Winzip. When you received your email in Outlook, you will have an attachment, which can be opened by Winzip.

Have you used uuencode/uudecode lately? Does this topic bring back any old memories?

Posted August 08, 2017 | Permalink

Post a Comment

Note: Comments are moderated and will not appear until approved

comments powered by Disqus