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?


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:


And apply the appropriate labels to the files.

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


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.

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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