0

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

firion
  • 99
  • 1
  • 5

1 Answers1

2
rpm --setugids openssh-server

You may also need to restart the service

symcbean
  • 19,931
  • 1
  • 29
  • 49
  • 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 09: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