Solved

sendmail error

Posted on 2006-11-05
8
426 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
  • 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Traceroute command on mac printing * * *** 10 74
SIP Trunk provider 20 95
IPA client Config problems 2 106
Cron jobs 12 91
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…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now