After restoring `/etc/shadow` from backup on an SELinux system, nobody can log in and logs show `pam_unix(sshd:auth): authentication failure`.
AdvancedTroubleshootingPermissions, ownership, SELinux and mounts
Answer
Likely causes → The restored file has the wrong SELinux label (or wrong mode), so login processes can't read it.
Diagnose → From console or rescue:
ls -lZ /etc/shadow # expect ---------- root root system_u:object_r:shadow_t
sudo ausearch -m AVC -ts today | grep shadow
Fix → restorecon -v /etc/shadow and chmod 000 /etc/shadow (RHEL) or 640 root:shadow (Debian). If you can't log in at all, boot with rd.break or rescue media, fix the file and touch /.autorelabel.
Prevent → Restore system files with tools that keep xattrs (tar --selinux, rsync -X) and always run restorecon after.
More on Permissions, ownership, SELinux and mounts
nginx returns 403 and logs `open() "/srv/www/index.html" failed (13: Permission denied)`, even after `chmod -R 777 /srv/www`.IntermediateA script fails with `bash: ./deploy.sh: Permission denied` even though `ls -l` shows `-rwxr-xr-x`.BeginnerA script fails with `/bin/bash^M: bad interpreter: No such file or directory`.BeginnerA user gets `-bash: cd: /srv/project: Permission denied` although they're in the group that owns `/srv/project` (mode `770`).BeginnerApache can't connect to a backend: `AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (localhost) failed` and `ausearch` shows `denied { name_connect }`.IntermediateA service fails to bind to a custom port: `bind() to 0.0.0.0:8888 failed (13: Permission denied)` while running as root.Intermediate