Unable to log in via ssh after editing SELinux configuration file

Asked 2 months ago, Updated 2 months ago, 3 views

I tried to edit and restart the following files in CentOS, but I couldn't log in with sshroot, please let me know!!

#This file controls the state of SELinux on the system.
# SELINUX=can take one of these three values:
#       enforcement-SELinux security policy is enforced.
#       permanent-SELinux prints warnings installed of enforcement.
#       disabled-SELinux is fully disabled.
SELINUX= enforcement
# SELINUXTYPE=type of policy in use. Possible values are:
#       targeted-only targeted network daemons are protected.
#       strict-Full SELinux protection.
SELINUXTYPE=targeted

setenforce0

I changed it to #setenforce0 and typed reboot, but the server immediately shut down and I couldn't log in with sshroot.

linux centos selinux

2022-09-30 11:18

3 Answers

If you commented out from setenforce0, I think SELinux is in execution mode.If it is a real terminal or VPS, you must enter the management console root and run fixfiles relabel. If you did not need to comment out setenforce0, please return it and do fixfiles relabel
If you fail, you may not be able to go back, so please look at the document and work on it.


2022-09-30 11:18

If setenforce0 also commented out with SELINUX=enforce, then SELinux may be limiting the ssh connection.

If you can operate the terminal console, the kernel parameters can temporarily make SELinux equivalent to Permissive mode = setenforce0.With VPS, you may be able to do it from the management screen.

[Linux] After disabling SELinux, Kernel panic is now disabled and cannot be started

I wonder why setenforce0 was written instead of SELINUX=disabled...


2022-09-30 11:18

Is there still a problem?
When SELinux is first enabled, it writes management information called labels to a file.
If you disable it and enable what was running, it will be labeled in the first boot process, so it appears to have stopped booting for a considerable amount of time.
If you wait a little bit (depending on the size, 30 minutes to an hour), you will be able to use it.


2022-09-30 11:18

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.