Wednesday, October 16, 2019

linux - Accidently ran "chown www-data:www-data / -R" as root




I just ran this a few seconds ago. I managed to do Ctrl - C as soon as I realized what I started doing.



So far the only directory it's started going through is /bin.



I'm afraid to do anything else. So far I realized I can't use su as my normal user anymore.



Luckily I still have another root terminal open. What do I do?


Answer



Most everything in /bin/ should be owned by root:root, so if you run the following you can fix the ownership on those files:




chown root:root -R /bin/ 


You may also want to make sure the setuid bit is properly set on /bin/su, which you can fix with the following:



chmod 4755 /bin/su

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...