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

1 Answer 1

2
rpm --setugids openssh-server

You may also need to restart the service

4
  • should I perform this on the remote machine?
    – firion
    Feb 10, 2018 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, 2018 at 19:47
  • What is the difference between this command and giving back the permissions with chown -R root /var/?
    – firion
    Feb 12, 2018 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, 2018 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .