Answer the question
In order to leave comments, you need to log in
How to roll back file permissions an hour ago in Ubuntu?
Guys, help me out. I have a VestaCP panel, everything worked fine 15 minutes ago. Then I restarted nginx and got a "500" error on one of the hosts, I was told that it was a matter of file permissions. The fact is that I threw the files through wget under my user and then changed them to the rights and the owner, which vesta sets by default. This unfortunately didn't help. After that, I decided to set permissions to 777 on the ENTIRE system, that is, chmod -R 777 / but without waiting for the result, I canceled part of the operation.
Then he applied the rights 777 to the /home and /etc folders, after which the sudo command stopped working. I realized that I had done a great x*nu and decided to correct the situation with the command chmod -R 755 /. Sudo worked, I rebooted...
As a result, Vesta writes "Internal vesta error", all hosts crashed with a "500" error, when trying to connect to SSH, it writes the error "Server unexpectedly closed network connection".
But the other panel works fine, there is a shell and root access.
How can I roll back the system 15 minutes ago? Perhaps somehow it is possible to cancel chmod or somehow solve this?
Answer the question
In order to leave comments, you need to log in
The question is not relevant.
The solution in my case (may work in yours too):
/usr/local/vesta/upd/add_sudo.sh && chmod 0440 /etc/sudoers && chown root:root /etc/sudoers
&& chmod 0440 /etc/sudoers.d/admin && chown root:root /etc/sudoers.d/admin && chown root:root /usr/bin/sudo
&& chmod 4755 /usr/bin/sudo
There is a suspicion that "to roll back the rights in the system to" 15 minutes ago "- nothing if a snapshot of the system or something like that has not been made before ... but there is a solution that is relatively not difficult.
1. Take the same exactly the system (for example, a similar server)
2. Write a script that will iterate over the entire file system and write to a text file, in the line: path to the file (directory) + rights to it
3. Upload the finished file with the resulting result to the server and run the reverse an operation similar to a script (setting rights in accordance with the specified path)
Or, take a similar working server and transfer all the data there ...
PS Perhaps there are more beautiful solutions, or even some system scripts (ready-made) that will set the necessary rights correctly, but, "quickly", the solution that I voiced above comes to my mind.
Then I restarted nginx and got a "500" error on one of the hosts, I was told that it was a matter of file permissions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question