How to disable SELINUX?
I tried to use this command
vi /etc/selinux/config but i do not know what to press to disable SELINUX, and when it is already disabled, does it need a reboot for it to be recognized as already disabled? |
How to disable SELINUX?
vi is a text editor, if you don't know how to use it I recommend using nano.
To disable selinux you will need to make sure SELINUX=disabled is in /etc/selinux/config. You will need to reboot for changes to take effect |
Quote:
|
First ensure you are the root user:
su - root enter root password. Instead of: vi /etc/selinux/config run: nano /etc/selinux/config you should be able to figure out how nano works but if you have issues: http://www.debianadmin.com/nano-editor-tutorials.html in the /etc/selinux/config file you should see a line starting with "SELINUX=", make sure that "SELINUX=disabled" save the file then run: shutdown -r now |
Quote:
|
Quote:
Here's a CentOS 6 oriented link: Disable SELinux CentOS 6 (basically the same as the earlier provided answer). BTW: The editor (nano or vi) is your choice and not of any influence of the outcome. EDIT: I've asked a moderator to move this to a more appropriate location to give it the exposure it deserves. |
Quote:
Sorry im really not that good with ssh. |
Quote:
Once you have changed SELINUX=enforcing to SELINUX=disabled in the /etc/selinux/config file and rebooted, you should be set. Selinux is still installed, but will not bother you any more with its restrictions. Quote:
Please elaborate. EDIT: I'm starting to wonder what your initial problem is and why you decided that disabling selinux would be the solution. |
Quote:
You can then run setenforce 0 to turn it off and setenforce 1 to turn it back on. This is temporary so you can do this to see if it has any effect on the problem before turning it off permanently as detailed above. I wouldn't recommend turning it off though. Why do you want to? Unless its an isolated/testing machine, really you should try to make it work, it has a purpose. |
Quote:
Using the vi command, it just shows the codes on the SELINUX. The ones found here: http://www.how2centos.com/disable-selinux-centos-6/ The guide says: Change SELINUX=enforcing to Change SELINUX=disabled and layed out some codes below it however it does not say how you will actually change it, i mean should you just type a command, or edit the code and then what? |
Quote:
Run the command sestatus as this will actually tell you if SELinux is enabled and what state is is in. |
Quote:
Quote:
Before I answer the above question I do have to ask one myself: Why do you need to change the selinux setting? Are you running into a specific problem and decided that disabling it would be the best choice? We might come up with a better solution if you tell us what the actual problem was that made you (or someone else) think that selinux should be disabled. About changing the /etc/selinux/config file: 1) Using putty log into the machine that needs to be changed. 2) Make sure you are the root user (id -un <- should show root) 2a) If you are not the root user use the following to do so: su - You will be asked the root password. I could explain how to do this using vi, but I'm going to use sed instead (less chance of something going wrong): 3) Use the following to change enforcing into disabled: Code:
sed -i.bak 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config You can check /etc/selinux/config, using vi or cat, to see if the entry is changed. If that is the case: Reboot. |
Permissive setting
I just want to add, albeit 5 years later, that there is also a 'permissive' setting that can be used instead of 'disabled'. Using the permissive setting resolved the problem I was having with Drupal telling me that a directory was not writable.
Steve |
I just want to add that '/usr/sbin/setenforce 0' works without rebooting.
|
All times are GMT -5. The time now is 05:57 AM. |