I've executed this command
chown -r user:user /after which I can't perform any sudo command. Also I can't connect to any Network. I want return all back. But how?
Since you are unable to use
sudo You would have to boot from a liveusb installation and change all of the permissions back from there.
As mentioned in Thomas Wards comment above, it would most likely be easier to use the liveusb to backup your data and then just reinstall the system
If you ran this as non-superuser (without
sudo and just your own user), you probably didn't do too much damage because outside your own user directory and maybe some bits of
/tmp/ (which you can probably fix with a reboot), your user wouldn't have the permissions to chagne things much.
However, if you ran this as
sudo or as the
root user, you're literally hosed.
Attempting to revert that amount of damage is a lesson in futility and self-punishment, as you'd have to have an exemplar clean system to know how to reset the ownership and permissions to. You'd also have to go directory by directory and file-by-file which is a VERY lengthy and nontrivial process that you'd have to do via the Live environment anyways.
Generally speaking, because you'd need to set up a system just to find the proper default permissions again, you'd be better off booting up to a LiveUSB / installer image, copying any data you want to keep off the drive as superuser in the Live environment to a second, external disk, and then blasting away the installed Ubuntu and reinstalling.