Solved

sendmail error

Posted on 2006-11-05
8
430 Views
Last Modified: 2010-03-18
hi;

when i want to run sendmail it gives en error like "sendmail: fatal: unable to switch to qmail home directory". so i cant send mail from php using mail function. my system is suse 10.0. and running postfix 2.5.5. what is the problem ?

thanks.
0
Comment
Question by:kenanerdey
[X]
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
  • 4
  • 4
8 Comments
 
LVL 26

Expert Comment

by:jar3817
ID: 17880433
If you're already running postfix, why do you need sendmail? You can just edit your /usr/local/lib/php.ini file to use postfix for sending mail rather than sendmail from php.
0
 

Author Comment

by:kenanerdey
ID: 17881622
i found the problem. as i am running apache as root, when i used /usr/sbin/sendmail it didn't give error. so i changed php.ini with new path.  
by the way sendmail is the mail client of postfix (postfix's sendmail wrapper)
0
 
LVL 26

Expert Comment

by:jar3817
ID: 17881948
DON'T RUN APACHE AS ROOT.

If your webserver is compromised (by fault of an exploit in apache or php or any other module related to apache) and apache is running as root, you will have handed your server (and all it's data) over to the attacker on a silver platter.  As if you losing control of your server wasn't bad enough, it would probably end up pumping out spam which affects everyone else. Do us all a favor and don't run apache (or any other public facing service) as root.

As for your original question, the "sendmail: fatal: unable to switch to qmail home directory" sounds like a permission problem. Once you figure out which directory this message is referring to, you can make it read/writable by the non-root user apache is running as (apache,nobody,daemon, whatever).
0
Independent Software Vendors: 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!

 

Author Comment

by:kenanerdey
ID: 17887536
do i have to do special to run it as user ( parameter or something) or just logon as user then run it ?
0
 
LVL 26

Expert Comment

by:jar3817
ID: 17889114
In your httpd.conf you have to have lines like this:

User  username
Group groupname

Instead of using hte names, you can use the uid and gid. If you don't have an apache user/group, you can use "nobody", that user and group should already exist on your system.
0
 

Author Comment

by:kenanerdey
ID: 17890481
yes it's working as wwwrun. but when i do ps -ef i see a httpd process run as root. but there are other httpd process run as wwwrun.
i tried something. i wrote a php script taking a parameter and include it. when i run it as ...exam.php?t=/etc/passwd  it showed me passwd file. but it can only be read by root. so this is a problem. ideas ?
0
 
LVL 26

Accepted Solution

by:
jar3817 earned 125 total points
ID: 17890781
/etc/passwd is usually world readable, that's how the system does uid to username translations. The same is true for /etc/group.  The actual passwords are usually kept in a file called /etc/shadow which should be only readable (400) for root:root. Be careful with scripts like that, a lot of damage can be done by leaving them laying around.
0
 

Author Comment

by:kenanerdey
ID: 17895961
you are right. i thought it's only readable by root. you have the points.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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