OCI Linux: Not Able Access Instance due to /etc Directory Permission Change (chmod -R 777 /etc)
in Linux
Applies to:
Linux OS - Version Oracle Linux 7.9 and later
Linux x86-64
Symptoms:
/etc directory permission was accidentally changed to 777 by running command below and unable to access the instance now# chmod -R 777 /etc/
Solution:
- Login to the server using single user mode
- Remount the root filesystem with read write option
# mount -o remount,rw /
# cd /etc
Check the current permissions# ls -ltr
- Revert permission changes to default by following commands
# rpm --setperms -a
If files user and group ownership also changed then run# rpm --setugids -a
- Files which are not owned by any packages need to be corrected manually below to regain ssh access
Tagged:
0