Link to home
Start Free TrialLog in
Avatar of ingenito
ingenitoFlag for United States of America

asked on

Can't compile virtualuser.db

Hello,

When I try to start sendmail I get this error:

ns1:/etc/mail # service sendmail restart
Shutting down sendmail: [  OK  ]
Shutting down sm-client: [  OK  ]
Starting sendmail: makemap: error opening type hash map virtusertable.db: Permission denied
make: *** [virtusertable.db] Error 73
[  OK  ]
Starting sm-client: [  OK  ]

How can I fix this?  If I run make from the command line trying to use DBM I get:

makemap: Need to recompile with -DNDBM for dbm support

How can I fix this?  Thanks.


Avatar of jlevie
jlevie

Typically the command to build the virtusertable map from the flat file would be:

makemap hash /etc/mail/virtusertable >/etc/mail/virtusertable

Is that what you tried?

Also does 'ls -l /etc/mail/virtusertable return results like:

-rw-r--r--    1 root     root        48929 Apr 17 21:00 /etc/mail/virtusertable
-rw-r-----    1 cyrus    root        81920 Apr 17 21:00 /etc/mail/virtusertable.db
Avatar of ingenito

ASKER

jlevie,

When I run the makemap command I get this error:

ns1:/etc/mail # makemap hash /etc/mail/virtusertable >/etc/mail/virtusertable2
makemap: error opening type hash map /etc/mail/virtusertable: Permission denied

The permissions on the files look like this:

ns1:/etc/mail # dir virtuser*    
-rw-r--r--    1 smmsp    mail            0 Apr 16 14:27 virtusertable
-rw-r--r--    1 smmsp    mail        12288 Sep 24  2003 virtusertable.db

Thanks.
That sort of sounds like a problem with makemap or Berkely DB.

I'm going to guess that this is a RedHat system or something similar. Accordingly I'd like to know what 'rpm --verify sendmail' shows. Assuming it is a recent version I'd also like to know what rpm --verify db4' shows.
Here you go:

ns1:/etc/mail # rpm --verify sendmail
SM5..UGT c /etc/aliases
.M...UG.   /etc/mail
.....UG. c /etc/mail/Makefile
.....UG. c /etc/mail/access
.....UG. c /etc/mail/domaintable
.....UG. c /etc/mail/helpfile
S.5..UGT c /etc/mail/local-host-names
.....UG. c /etc/mail/mailertable
S.5....T c /etc/mail/sendmail.cf
S.5..UGT c /etc/mail/sendmail.mc
SM5..UGT c /etc/mail/statistics
SM5..UGT c /etc/mail/submit.cf
.....UG. c /etc/mail/submit.mc
.....UG. c /etc/mail/trusted-users
.....UGT c /etc/mail/virtusertable
.M......   /usr/sbin/sendmail.sendmail
.M...U..   /var/spool/mqueue
ns1:/etc/mail # rpm --verify db4
ns1:/etc/mail #

Looks like db4 is a problem. Can I install this through up2date?  Thanks
I tried this as well:

ns1:/etc/mail # up2date --install db4

Fetching package list for channel: redhat-linux-i386-9...
########################################

Fetching Obsoletes list for channel: redhat-linux-i386-9...
########################################

Fetching rpm headers...

The following packages you requested are already updated:
db4
That all looks okay, except that the change in mode for /usr/sbin/sendmail.sendmail and the change in mode/user for /var/spool/mqueue are supicious. Could I see what 'ls -l /usr/sbin/sendmail.sendmail' and 'ls -ld /var/spool/mqueue' shows?

Also I'd like to see what happens if you execute '/usr/bin/makemap hash /etc/mail/virtusertable >/etc/mail/virtusertable'. Type that command in exactly and if it succeeds  I'd like to know what 'type makemap' shows.
ns1:/etc # ls -l /usr/sbin/sendmail.sendmail
-r-sr-sr-x    1 root     smmsp      663232 Sep 17  2003 /usr/sbin/sendmail.sendmail
ns1:/etc # ls -ld /var/spool/mqueue
drwxrwx---    2 smmsp    mail        45056 Apr 19 15:10 /var/spool/mqueue
ns1:/etc # /usr/bin/makemap hash /etc/mail/virtusertable >/etc/mail/virtusertable
makemap: error opening type hash map /etc/mail/virtusertable: Permission denied

Those are unsafe permissions for sendmail and it should look like:

-rwxr-sr-x    1 root     smmsp      733888 Sep 18  2003 /usr/sbin/sendmail.sendmail

In a like manner the perms on /var/spool/mqueue should look like:

drwx------    2 root     mail         4096 Apr 19 04:02 /var/spool/mqueue/

The question now is how did they get like that?

What does 'ldd /usr/bin/makemap | grep libdb' show?
Well those permissions were my fault.  I was trying to make sendmail not run as root.  Is it safe to have sendmail running as root?  Anyway, that is the reason for the wierd permissions, I will change them.  Here is the result of the ldd command:

ns1:/etc/mail # ldd /usr/bin/makemap | grep libdb
        libdb-4.0.so => /lib/libdb-4.0.so (0x4001a000)

Thanks for your patience.  I am semi-new to linux.  Been with Windows all my life.
ASKER CERTIFIED SOLUTION
Avatar of jlevie
jlevie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
jlevie,

I changed those permissions to the same that you have.  Thanks.  Have you any idea about the makemap problem?
jlevie,

I seemed to have fixed the problem by making my /etc/mail directory look like this:

ns1:/etc/mail # dir
total 388
drwxr-xr-x    2 smmsp    mail         4096 Apr 20 16:49 .

So now it is group and other readable and execuatble.  Once I changed this I was able to compile the hash virtusertable.

Thanks for your help jlevie.