This is pretty hard to solve.
Maybe there is very little chance but usually problems like these finishes with Rebuilding droplets or restoring backups.
I will try to give you few ideas how to fix but I can't guarantee it will work, or it will make it work worse. Use it on your own risk.
First problem is that you don't know anymore who is default owner of files. You can try to give owner of everything to
root. Maybe it will work better, but
root is not default owner of all files/folders.
You can spin one $5 droplet and look at default owners.
If you are using Ubuntu 14.04.x you should have option of Recovery kernel.
On Ubuntu 16.04, you are out-of-luck with Recovery kernel, as it is not possible to change kernel anymore. Maybe you can contact support and ask them to enable it for you, but I'm not sure is it possible anymore.
If you have this possibility or DO let you somehow use it, you will need Interactive Shell, in which you can try giving everything to
root or looking at default owners and giving it to files respectively.
You can give everything to
root with (not recommended, really):
want to give to their default owner syntax of
chown command is:
chown user:group file
or if you want to apply to all files in directory
chown -R user:group directory
-R switch, it means recursively, it will apply permissions/owner to all directories/files in selected directory.
If you don't have recovery kernel, I have found somewhere this command:
- pkexec chown root:root /usr/bin/sudo
It should return your
sudo so you can use
chown from your system.
You can try it as
root user if it is not working from non-root user. If you disabled
root logins via SSH, you can use Console. Go to Control Panel, select your droplet and click console. If you don't have password, you can use option
Reset root password from Control Panel.
After that try
sudo to see if it works.
Anyways with this wall of text, I really, really recommend you to rebuild droplet or restore backup. You will never know right permissions, and server can break anytime.