I have SSH access to a Centos 7 virtual machine. I wanted to change the permissions on the apache folder (var/www) on my user in order to edit the files remotely, but I erroneously performed chown -R <user> /var/. Now I cannot SSH anymore. How can I solve this problem? What could be the reason? EDIT: I don't have access to the physical machine that hosts the virtual machine

rpm --setugids openssh-server

You may also need to restart the service

  • should I perform this on the remote machine? – firion Feb 10 '18 at 16:00
  • On the machine you performed the accidental chown -R, yes. Since you cannot SSH into the system, this will probably require accessing the console of the VM. If you don't have console access to your VM, you may need to contact the administrator of the physical host. – telcoM Feb 10 '18 at 19:47
  • What is the difference between this command and giving back the permissions with chown -R root /var/? – firion Feb 12 '18 at 9:00
  • @Francesco: if root is the rightful owner of the files, then what is preventing root from reading and writing them? – symcbean Feb 12 '18 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.