On my GCP instance I recently updated SELINUX to 'enforcing' and performed a sudo reboot to restart the instance. Now I'm unable to access my instance through the google cloud console via ssh. I keep getting

/bin/bash: Permission denied.

Is there no other way to access my instance other than ssh? I'm running my GCP on Centos 7


Before rebooting, you also needed to touch /.autorelabel so that the files which were missing their SELinux labels because it was disabled would have the labels applied on next boot.

You can mount your instance's storage to a different instance to add this file, and then reboot the original instance again.

It is best practice to never set SELinux to disabled. If it must be off temporarily, or even permanently, it should be set to permissive instead, so that this sort of thing does not happen when it is reset to enforcing.

  • Thanks Michael. I was following a thread that had me disable SELINUX order to get my postfix mail working.. but that's another issue. So I will try to make a snapshot of my disk and mount it to a new instance and let you know how it goes. – TroyB Jul 24 '20 at 2:21

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.