Originally Posted by kirthanshetty
By mistake i have given permission chmod -R 777 /etc on Ubuntu, Can you please help me how to fix it ?
You might make a directory listing and post it (in sections if it isn't too long).
The most significant files and directories to change are those with the logins (/etc/passwd, which should be 744, /etc/shadow, which on my system is 000), then there are the system update configurations (usually 644), ssh (766 as it is a directory), and the contents of ssh (set them all to 600, then add read to ssh_config, and *.pub, though deleting and rebuilding the keys can be considered better).
Most of the rest, regular files would be 644, directories 755.
This will NOT fix everything. For instance wpa_supplicant.conf on my system is 600, which restricts it to root only.
You might check your install utility - sometimes there is an option to just fix ownership and access modes of install files without actually doing an install. This still won't necessarily fix everything, as local installation may have files with their own needs.
It is one reason I do backup the root filesystem - it lets me restore certain things after an accident like this (yes, I've done it too).