Senior
Junior executed chmod -x /bin/chmod and lost execute permissions. How to restore?
sobes.tech AI
Answer from AI
The command chmod -x /bin/chmod removed the execute permissions from the chmod binary itself, making it impossible to use this command to restore permissions. To restore execute permissions, you can:
- Log in as a user with root privileges (for example, via
sudo suor directly in recovery mode). - Run the command:
chmod +x /bin/chmod
If chmod is unavailable, you can use alternative methods:
- Use
install(if available):
install -m 755 /bin/chmod /bin/chmod
- Use
busybox chmod(if busybox is installed):
busybox chmod +x /bin/chmod
- Reboot into recovery mode or with a liveCD, mount the root partition, and fix the permissions.
The main goal is to gain access to the system with root privileges and use any available tool to restore execute permissions to the file.