mode issue on uuencode

Posted on 2006-07-19
Last Modified: 2012-06-22
Hi -
I'm using uuencode to email an attachment using sendmail (this option cannot change) and on the test system, it sets the mode as 0 in the begin line, instead of the same as the file permissions (which is set to 666):
begin 0 Report.txt

On production, the file permissions on the file are 664, and it creates the following:
begin 666 Report.txt

Now, the versions of uuencode are different on the test vs production.
Test - $Revision: 92453-07 linker linker crt0.o A.10.44 951205 $
Prod -  $Revision: 92453-07 linker linker crt0.o B.11.16 000601 $
(not sure how else to get the version of uuencode)

Is there some kind of known issue or something that the mode in the begin line of the encoded text does not match exactly the file's permissions?  Or maybe we aren't using uuencode correctly, or are missing a setting, etc...  The production begin line we can live with, since at least the users can still decode the email attachment, but the 0 does not decode at all.  Any help is appreciated.   Currently, we are scanning the encoded text for the begin line with the 0 and replacing with 666 so as to get it to work, but would like to do this the right way, instead of a hack :)

Let me know if any additional info is needed.

Question by:sandr5
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 17149370

I think the Revision number you are seeing relate to the C compiler that compile the uuencode command.

you might try a 'what' command against your uuencode binary.

LVL 16

Expert Comment

by:Hanno P.S.
ID: 17166086
Do you encode a plain file without any setuid and/or setgid mode?

Author Comment

ID: 17167371
Yep - it's just a text file with some text and the actual source looks like -

        echo "From: $From
To: $RecptEmailAddress
Cc: $SenderemailAddress
Reply-To: $RecptEmailAddress
Subject: $NotifySubject

`cat $CoverLetterName`

`cat $ActualFileName | uuencode TransactionReport.txt `

." | /usr/sbin/sendmail -t
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.


Accepted Solution

JJSmith earned 250 total points
ID: 17188576

if you are 'uuencode'ing standard input;

`cat $ActualFileName | uuencode TransactionReport.txt`

and pipeing that to a sendmail command - how do expect file permissions to be detemined?

I would check the umask in both environments to see if that accounts for 666 in production and 0 in test.


Author Comment

ID: 17192212
Hi -
I see the umask in test is 00 and in prod is 00 (I'm not sure if i checked it right, typed "umask" at the prompt).  I also "touched" a file in test, and the permissions on it were 666 (this is logged in as the user under which the scripts are run)

However, you bring up an interesting point about the piping to the uuencode.  Instead, I changed it to be
`uuencode $ActualFileName TransactionReport.txt`
." | /usr/sbin/sendmail -t

and that works to set the mode value to 666 (or even 777 if I change the permissions on the $ActualFileName first!), so this we will use.
Thanks so much for your help.

Author Comment

ID: 17192230
Oops, I guess I clicked on a link while typing my post, and the link got embedded.  Please ignore that.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (, discussed installing the Solaris Operating S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question