Jump to content

Hey guys, in some trouble here. I recently did a yum update and turned on enforcing on SELinux while setting up an httpd server and now I cannot SSH or login into my server?

 

Everytime I login, it does login successfully but kicks me out instantly, it's almost like a login loop. How can I see that I'm logging in? Because it gives me the "Last login" message.

 

Please see below:

➜  ~ ssh root@192.168.0.215
root@192.168.0.215's password:
Last login: Fri Jul 26 14:01:15 2019 from 192.168.1.2
/bin/bash: Permission denied
Connection to 192.168.0.215 closed.

Any ideas? This is running on a HyperV host

My Gaming Rig: AMD Ryzen 5600x  |  Corsair H100i GTX  |  ASUS ROG Strix B450-F Gaming  |  32GB Samsung DDR4 3600MHz  |  ASUS RTX 3070 ROG Strix  |  WD Black 240GB NVMe  |  1TB Samsung 850 Pro SSD | 2TB Samsung Enterprise SSD  |  WD Black 1.5TB   |  3x NZXT Aer RGB 140MM  |  Seasonic Focus 750w   |  NZXT H500 Elite   |  Windows 10 Pro

 

My Home Server: AMD Ryzen 1400x  |  Gigabyte Aurora B550 Elite  |  32Gb Samsung DDR3 3200Mhz  |  HP RTX 2060 6GB  |  1TB Samsung 850 Pro  |  2x Seagate IronWolf Pro 18TB | 3x Seagate IronWolf Pro 4TB |  2x WD Green 2TB  |  Corsair CX650m  | Bitfenix Shinobi | Windows Server 2022

Link to comment
https://linustechtips.com/topic/1086692-help-binbash-permission-denied/
Share on other sites

Link to post
Share on other sites

What happens if you disable SELinux? (setenforce 0)

 

Any errors under dmesg? 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | Asus RTX 4060 Dual OC | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO + 4 Additional Venturi 120mm Fans | 8 x 20TB Seagate Exos X22 | 4 x 16TB Seagate Exos X18 | 3 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Spoiler

NAS: Innovision 4U 24-bay chassis (12GB MiniHD SGIO Backplane) | Intel Core i9-10980xe | EVGA X299 FTW-K | EVGA RTX 2080Ti Super FTW3 | 128GB (8x16GB) Corsair Vengeance LPX 3200Mhz | DEEPCOOL PN1000M PSU| Noctua NH-D12L Chromax Black | 16 x 16TB Seagate Exos X18 | 2 x 2TB Samsung 990 Pro | 2 x 2TB Intel U.2 P4510 | LSI 9305-24i HBA

 

Link to post
Share on other sites

1 minute ago, Jarsky said:

What happens if you disable SELinux? (setenforce 0)

 

Any errors under dmesg? 

I cannot gain access to the machine at all! 

 

Although, rsyslog is configured to push logs to a Graylog server running, lemme see if there was any errors on there.

My Gaming Rig: AMD Ryzen 5600x  |  Corsair H100i GTX  |  ASUS ROG Strix B450-F Gaming  |  32GB Samsung DDR4 3600MHz  |  ASUS RTX 3070 ROG Strix  |  WD Black 240GB NVMe  |  1TB Samsung 850 Pro SSD | 2TB Samsung Enterprise SSD  |  WD Black 1.5TB   |  3x NZXT Aer RGB 140MM  |  Seasonic Focus 750w   |  NZXT H500 Elite   |  Windows 10 Pro

 

My Home Server: AMD Ryzen 1400x  |  Gigabyte Aurora B550 Elite  |  32Gb Samsung DDR3 3200Mhz  |  HP RTX 2060 6GB  |  1TB Samsung 850 Pro  |  2x Seagate IronWolf Pro 18TB | 3x Seagate IronWolf Pro 4TB |  2x WD Green 2TB  |  Corsair CX650m  | Bitfenix Shinobi | Windows Server 2022

Link to post
Share on other sites

ssh_selinux_change_context: setcon system_u:system_r:sshd_net_t:s0 from system_u:system_r:kernel_t:s0 failed with Permission denied [preauth]

Failed to start user slice user-0.slice, ignoring: Access denied (org.freedesktop.DBus.Error.AccessDenied)

Failed to start session scope session-3.scope: Access denied

pam_systemd(sshd:session): Failed to create session: Access denied


audit event#012node=centos.localdomain type=AVC msg=audit(1564147354.265:198): avc:  denied  { dyntransition } for  pid=3065 comm="sshd" scontext=system_u:system_r:kernel_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0 tclass=process permissive=0#012#012node=centos.localdomain type=SYSCALL msg=audit(1564147354.265:198): arch=c000003e syscall=1 success=no exit=-13 a0=6 a1=5584270cee60 a2=2a a3=666e6f636e753a72 items=0 ppid=3034 pid=3065 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=3 comm="sshd" exe="/usr/sbin/sshd" subj=system_u:system_r:kernel_t:s0 key=(null)

Looks to be SELinux alright I think? ?

My Gaming Rig: AMD Ryzen 5600x  |  Corsair H100i GTX  |  ASUS ROG Strix B450-F Gaming  |  32GB Samsung DDR4 3600MHz  |  ASUS RTX 3070 ROG Strix  |  WD Black 240GB NVMe  |  1TB Samsung 850 Pro SSD | 2TB Samsung Enterprise SSD  |  WD Black 1.5TB   |  3x NZXT Aer RGB 140MM  |  Seasonic Focus 750w   |  NZXT H500 Elite   |  Windows 10 Pro

 

My Home Server: AMD Ryzen 1400x  |  Gigabyte Aurora B550 Elite  |  32Gb Samsung DDR3 3200Mhz  |  HP RTX 2060 6GB  |  1TB Samsung 850 Pro  |  2x Seagate IronWolf Pro 18TB | 3x Seagate IronWolf Pro 4TB |  2x WD Green 2TB  |  Corsair CX650m  | Bitfenix Shinobi | Windows Server 2022

Link to post
Share on other sites

12 minutes ago, KingCollins said:

I cannot gain access to the machine at all! 

So not even through hyper-v console?? It should only be affecting remote tty (ssh) 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | Asus RTX 4060 Dual OC | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO + 4 Additional Venturi 120mm Fans | 8 x 20TB Seagate Exos X22 | 4 x 16TB Seagate Exos X18 | 3 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Spoiler

NAS: Innovision 4U 24-bay chassis (12GB MiniHD SGIO Backplane) | Intel Core i9-10980xe | EVGA X299 FTW-K | EVGA RTX 2080Ti Super FTW3 | 128GB (8x16GB) Corsair Vengeance LPX 3200Mhz | DEEPCOOL PN1000M PSU| Noctua NH-D12L Chromax Black | 16 x 16TB Seagate Exos X18 | 2 x 2TB Samsung 990 Pro | 2 x 2TB Intel U.2 P4510 | LSI 9305-24i HBA

 

Link to post
Share on other sites

The HyperV MMC should indeed work. Try that for good measure.

PC Specs - AMD Ryzen 7 5800X3D MSI B550M Mortar - 32GB Corsair Vengeance RGB DDR4-3600 @ CL16 - ASRock RX7800XT 660p 1TBGB & Crucial P5 1TB Fractal Define Mini C CM V750v2 - Windows 11 Pro

 

Link to post
Share on other sites

10 minutes ago, NelizMastr said:

The HyperV MMC should indeed work. Try that for good measure.

I've tried multiple times now. Lemme try once more for good measure.

My Gaming Rig: AMD Ryzen 5600x  |  Corsair H100i GTX  |  ASUS ROG Strix B450-F Gaming  |  32GB Samsung DDR4 3600MHz  |  ASUS RTX 3070 ROG Strix  |  WD Black 240GB NVMe  |  1TB Samsung 850 Pro SSD | 2TB Samsung Enterprise SSD  |  WD Black 1.5TB   |  3x NZXT Aer RGB 140MM  |  Seasonic Focus 750w   |  NZXT H500 Elite   |  Windows 10 Pro

 

My Home Server: AMD Ryzen 1400x  |  Gigabyte Aurora B550 Elite  |  32Gb Samsung DDR3 3200Mhz  |  HP RTX 2060 6GB  |  1TB Samsung 850 Pro  |  2x Seagate IronWolf Pro 18TB | 3x Seagate IronWolf Pro 4TB |  2x WD Green 2TB  |  Corsair CX650m  | Bitfenix Shinobi | Windows Server 2022

Link to post
Share on other sites

Also, logging in directly as root is really not best practice. Use a named user account instead and go into root mode whenever needed.

PC Specs - AMD Ryzen 7 5800X3D MSI B550M Mortar - 32GB Corsair Vengeance RGB DDR4-3600 @ CL16 - ASRock RX7800XT 660p 1TBGB & Crucial P5 1TB Fractal Define Mini C CM V750v2 - Windows 11 Pro

 

Link to post
Share on other sites

9 minutes ago, NelizMastr said:

Also, logging in directly as root is really not best practice. Use a named user account instead and go into root mode whenever needed.

That's usually what I do, I log in as a separate user and sudo su. But neither are working.

 

Non root user on MMC:

audit event#012node=centos.localdomain type=AVC msg=audit(1564150060.309:294): avc:  denied  { transition } for  pid=4641 comm="login"
path="/usr/bin/bash" dev="dm-0" ino=1194 scontext=system_u:system_r:kernel_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0
tclass=process permissive=0#012#012node=centos.localdomain type=SYSCALL msg=audit(1564150060.309:294): arch=c000003e syscall=59 success=no
exit=-13 a0=c4b252 a1=7fff67d859f8 a2=c55490 a3=7fff67d85220 items=0 ppid=4587 pid=4641 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000
fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=tty1 ses=7 comm="login" exe="/usr/bin/login" subj=system_u:system_r:kernel_t:s0 key=(null)

Logging in does not give me a "Login incorrect" error. Just loops back to login.

My Gaming Rig: AMD Ryzen 5600x  |  Corsair H100i GTX  |  ASUS ROG Strix B450-F Gaming  |  32GB Samsung DDR4 3600MHz  |  ASUS RTX 3070 ROG Strix  |  WD Black 240GB NVMe  |  1TB Samsung 850 Pro SSD | 2TB Samsung Enterprise SSD  |  WD Black 1.5TB   |  3x NZXT Aer RGB 140MM  |  Seasonic Focus 750w   |  NZXT H500 Elite   |  Windows 10 Pro

 

My Home Server: AMD Ryzen 1400x  |  Gigabyte Aurora B550 Elite  |  32Gb Samsung DDR3 3200Mhz  |  HP RTX 2060 6GB  |  1TB Samsung 850 Pro  |  2x Seagate IronWolf Pro 18TB | 3x Seagate IronWolf Pro 4TB |  2x WD Green 2TB  |  Corsair CX650m  | Bitfenix Shinobi | Windows Server 2022

Link to post
Share on other sites

3 minutes ago, KingCollins said:

That's usually what I do, I log in as a separate user and sudo su. But neither are working.

 

Non root user on MMC:


audit event#012node=centos.localdomain type=AVC msg=audit(1564150060.309:294): avc:  denied  { transition } for  pid=4641 comm="login"
path="/usr/bin/bash" dev="dm-0" ino=1194 scontext=system_u:system_r:kernel_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0
tclass=process permissive=0#012#012node=centos.localdomain type=SYSCALL msg=audit(1564150060.309:294): arch=c000003e syscall=59 success=no
exit=-13 a0=c4b252 a1=7fff67d859f8 a2=c55490 a3=7fff67d85220 items=0 ppid=4587 pid=4641 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000
fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=tty1 ses=7 comm="login" exe="/usr/bin/login" subj=system_u:system_r:kernel_t:s0 key=(null)

Logging in does not give me a "Login incorrect" error. Just loops back to login.

Well I think you've locked yourself out completely. If you aren't permitted to use bash and you can't supply a different shell entirely you're looking at a rebuild of the machine.

PC Specs - AMD Ryzen 7 5800X3D MSI B550M Mortar - 32GB Corsair Vengeance RGB DDR4-3600 @ CL16 - ASRock RX7800XT 660p 1TBGB & Crucial P5 1TB Fractal Define Mini C CM V750v2 - Windows 11 Pro

 

Link to post
Share on other sites

Unless you took a snapshot, I don't see you being able to do anything short of shutting it down, attaching the disk to another VM and creating a mount point and editing /etc/selinux/config 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | Asus RTX 4060 Dual OC | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO + 4 Additional Venturi 120mm Fans | 8 x 20TB Seagate Exos X22 | 4 x 16TB Seagate Exos X18 | 3 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Spoiler

NAS: Innovision 4U 24-bay chassis (12GB MiniHD SGIO Backplane) | Intel Core i9-10980xe | EVGA X299 FTW-K | EVGA RTX 2080Ti Super FTW3 | 128GB (8x16GB) Corsair Vengeance LPX 3200Mhz | DEEPCOOL PN1000M PSU| Noctua NH-D12L Chromax Black | 16 x 16TB Seagate Exos X18 | 2 x 2TB Samsung 990 Pro | 2 x 2TB Intel U.2 P4510 | LSI 9305-24i HBA

 

Link to post
Share on other sites

Ok, I managed to log into single user mode after editing the kernel boot line.

 

I have a few options but of course I cannot see the /etc/selinux directory.

 

Any suggestions?

My Gaming Rig: AMD Ryzen 5600x  |  Corsair H100i GTX  |  ASUS ROG Strix B450-F Gaming  |  32GB Samsung DDR4 3600MHz  |  ASUS RTX 3070 ROG Strix  |  WD Black 240GB NVMe  |  1TB Samsung 850 Pro SSD | 2TB Samsung Enterprise SSD  |  WD Black 1.5TB   |  3x NZXT Aer RGB 140MM  |  Seasonic Focus 750w   |  NZXT H500 Elite   |  Windows 10 Pro

 

My Home Server: AMD Ryzen 1400x  |  Gigabyte Aurora B550 Elite  |  32Gb Samsung DDR3 3200Mhz  |  HP RTX 2060 6GB  |  1TB Samsung 850 Pro  |  2x Seagate IronWolf Pro 18TB | 3x Seagate IronWolf Pro 4TB |  2x WD Green 2TB  |  Corsair CX650m  | Bitfenix Shinobi | Windows Server 2022

Link to post
Share on other sites

I GOT IN!!!!

 

I had to add selinux=0 as a kernel boot parameter to disable SELinux when booting.

 

Oh thank god, I can sleep tonight.

 

Thanks guys for the suggestions.

My Gaming Rig: AMD Ryzen 5600x  |  Corsair H100i GTX  |  ASUS ROG Strix B450-F Gaming  |  32GB Samsung DDR4 3600MHz  |  ASUS RTX 3070 ROG Strix  |  WD Black 240GB NVMe  |  1TB Samsung 850 Pro SSD | 2TB Samsung Enterprise SSD  |  WD Black 1.5TB   |  3x NZXT Aer RGB 140MM  |  Seasonic Focus 750w   |  NZXT H500 Elite   |  Windows 10 Pro

 

My Home Server: AMD Ryzen 1400x  |  Gigabyte Aurora B550 Elite  |  32Gb Samsung DDR3 3200Mhz  |  HP RTX 2060 6GB  |  1TB Samsung 850 Pro  |  2x Seagate IronWolf Pro 18TB | 3x Seagate IronWolf Pro 4TB |  2x WD Green 2TB  |  Corsair CX650m  | Bitfenix Shinobi | Windows Server 2022

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×