Friday, August 29, 2008

sendmail problem on RHEL Linux

mail command wasn't sending the mail with following error:

[root@host1]# mail -v -s test tbabar
fprintf.c:50: SM_REQUIRE((fp) != NULL && (fp)->sm_magic == (SmFileMagic)) failed

From the /var/log/maillog it was found that:
sendmail[8698]: m7TB22jG008698: SYSERR(root): queueup: cannot create queue file ./qfm7TB22jG008698, euid=51, fd=-1, fp=0x0: No space
left on device

Made some free space on /var, after which mail started working.

mail command wasn't showing any error but also wasn't sending mail.
/var/log/maillog was showing:

sendmail[8656]: m7TEbgoL008656: SYSERR(root): collect: Cannot write ./dfm7TEbgoL008656 (bfcommit, uid=0, gid=51): No such file or dir

It was found that the problem was due to 'sendmail' binary permission problem, removed 'write' permission of owner & it started working. This is bit strange but....

#which sendmail
# ls -l /usr/sbin/sendmail
lrwxrwxrwx 1 root root 21 Aug 29 14:12 /usr/sbin/sendmail -> /etc/alternatives/mta
# ls -l /etc/alternatives/mta
lrwxrwxrwx 1 root root 27 Aug 29 14:25 /etc/alternatives/mta -> /usr/sbin/sendmail.sendmail
# ls -l /usr/sbin/sendmail.sendmail
-r-xr-sr-x 1 root smmsp 746328 Jan 22 2007 /usr/sbin/sendmail.sendmail

Note: The permissions required for 'sendmail' files can be found in /usr/share/doc/sendmail/SECURITY file.

Unable to 'su' on RHEL linux

A root user wasn't able to su to any other user. After executing su command neither it will switch to other user nor shell will change.

It was found that this was because corrupted 'su' binary.

[root@lxdevtst ~]# which su
[root@lxdevtst ~]# ls -l /bin/su
-rwsr-xr-x 1 root root 0 Jul 18 11:49 /bin/su

See above, the file size is zero. To resolve this, forcefully installed the 'coreutils' rpm, which provides this binary.