Changed premissions in home folders and computer won't boot I thought would be a good idea to run chmod o-w,o-r,o-x in my home folder and /var/root.

After doing that, programs were unable to start properly, saying they couldn't write to /var/folders. I moved folders to folders 2, but no joy. I ran chmod -R 755 in both folders and things were kind of fixed, but programs couldn't access the keychain. I restored back the original /var/folders, but now all I get is the Apple loading bar stuck at boot and can't boot to safe mode. macOS Sierra, SIP disabled.
Boot to Recovery HD, choose Utilities → Terminal, run resetpassword and choose to reset permissions and ACLs for your user account.

If that doesn't work, you may have to reinstall macOS. SIP protects the permissions on OS files, so disabling that will allow you to run commands which break the OS.