How to disable SELinux temporarily or permanently in Centos 6/7 and RHEL 6/7

SELinux is described as a mandatory access control (MAC) security structure executed in the kernel. SELinux offers a means of enforcing some security policies which would otherwise not be effectively implemented by a System Administrator.

The SELinux feature or service is enabled by default, due to this some applications on your system may not actually support this security mechanism. Therefore, to make such applications function normally, you have to disable or turn off SELinux.

# sestatus

Disable SELinux Temporarily

To disable SELinux temporarily, issue the command below as root:

# echo 0 > /selinux/enforce

Alternatively, you can use the setenforce tool:

# setenforce 0

Else, use the Permissive option instead of 0:

# setenforce Permissive

Disable SELinux Permanently

To permanently disable SELinux, use your favorite text editor to open the file /etc/sysconfig/selinux

# nano /etc/sysconfig/selinux

Then change the directive SELinux=enforcing to SELinux=disabled

SELINUX=disabled

Then, save and exit the file, for the changes to take effect, you need to reboot your system and then check the status of SELinux using sestatus:

# sestatus

Recover missing .vmx .vmdk descriptor files – esxi 5.5 6.0 6.5

To recreate .vmx file, bios etc, the easiest way is to create a new VM with the same hardware settings as the original one (of course, if you remember it…). So just "New Virtual Machine –> Typical" and so on.

To recover a .vmdk descriptor file you should follow below steps:

  1. Identify the size of the flat file in bytes. Create a new blank virtual disk that is the same size as the original. This serves as a baseline example that is modified in later steps.
  2. vmdk_missing
    As on above screenshot, use the vmkfstools command to create a new virtual disk: vmkfstool -c size -a lsilogic -d thin name where:
  • -c size – This is the size of virtual disk
  • -a virtual_controller (BusLogic, LSILogic,Paravirtual, or IDE)
  • -d thin  – This creates the disk in thin-provisioned format (also zeroedthick , eagerzeroedthick options available)
  1. Rename the descriptor file (also referred to as a header file) of the newly-created disk to match the name of the original virtual disk.

rename_vm

  1. Modify (using vi) the contents of the renamed descriptor file to reference the flat file.
  • run vi name_of_vmdk. In my case vi recreated_vmdk.vmdk . You will see similar file with name of -flat.vmdk file:

vmdk_file_view

  • change the colored name to a new one. (on vi editor, please type "i" to edit file). In my case:

vmdk_recreated

  • save file by typing :wq!
  1. Now you can add a disk to VM: