Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am working with the Linux -64 AMI on AWS. I am trying to get my mail server running on the box.

In an attempt to turn on SELinux I did

Edited /boot/grub/grub.conf and added selinux=1 to the end of the kernel statement

Then touch /.autorelabel

And then rebooted.

Upon reboot I web browse to my website and I get a server access error saying I can not access /

Of course I do not want to be at the root. What has gone wrong here?

How can I get SELinux enabled so I can run a mail server?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

SELinux is very restrictive by default, depending on distribution. You will have to explicitly enable access, depending on your configuration.

In the case of Red Hat, with SELinux enabled, /var/www is access, but if your sites are on /home, it won't be. You have to enable it with:

setsebool -P httpd_enable_homedirs on

You can pull the list of policies you can enable with:

getsebool -a

It is a lot, so you will have to grep for the service you want to enable access. Again, in the case of Red Hat, you only need to enable spooling for mail, so it will work by default. However, it may be different with your distribution. That and your web directory may be in a completely different location.

So you need go the selinux directory and look at the policies, roles and files contexts, which may be available at:

/etc/selinux

And apply the appropriate labels to the files.

I suggest you look at this as a base starting point:

http://selinuxproject.org/page/Main_Page

If you want to keep running SELinux. Otherwise, either use a different distribution that makes it easy for your to manage SELinux or put it in permissive mode for now and use some other mechanism to secure your server - at least until you get the hang of SELinux.

share|improve this answer
    
Rilindo thanks for all the info. You are right I have a lot to learn with SELinux. For now until I get my mail working properly I just turned it off to fight that battle then will turn it back on when ready. –  enfield Sep 14 '11 at 10:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.