Saved by uuencode (yes, uuencode)

Edit: When was the last time you used this?

Originally posted August 8, 2017 on AIXchange

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.
    #vtmenu
    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/snapAt this point, the file was “uuencoded,” and these characters scrolled over my screen (and were also logged to the file I’d specified):

M=/A%;-$,#3.)G\10XBAQ/[@=R52H#)0!`,.P8?BPEG@Z++04$0>)CY9@IMUP
M?IC]\)#L6P*$-<.”R_XPCUA*C+8\-\(‘9(>BX2QQ8[@S'”*V!TN&=4\1`MTP
M/WA,?,5X6HZ$?\,E81:Q<-A%S”9F6FHT89Z]@_7P&0`L[!YN$7.)W54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A1JRAF%`./'<71TM]8S?@@62G^'”>/^\?+XYYQ
*`#EKW#C.($,<`<8$
`
end

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/snapI 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” email@hostname.com
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?