[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

sendmail error

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
kenanerdey
Asked:
kenanerdey
  • 4
  • 4
1 Solution
 
jar3817Commented:
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
 
kenanerdeyAuthor Commented:
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
 
jar3817Commented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
kenanerdeyAuthor Commented:
do i have to do special to run it as user ( parameter or something) or just logon as user then run it ?
0
 
jar3817Commented:
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
 
kenanerdeyAuthor Commented:
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
 
jar3817Commented:
/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
 
kenanerdeyAuthor Commented:
you are right. i thought it's only readable by root. you have the points.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now