This question already has an answer here:
I was working on some SFTP via filezilla to allow download and reupload of some file I took owner ship via ROOT and chown -R 'myusername' /etc and chmod 777 my user account for -R /etc
Now I got timed out and tried to login to root again and it gives me error sudo: /etc/sudoers is owned by uid 1000, should be 0 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin I have access to the /etc and 777 on all the files and also can access them via FTP so please suggest how to restore access to the root account Also the root as no password at this time so i cant run the general pkexec or visudo commands.
Please suggest a solution and also if there is a way to manually reset the /etc/shadow or passwd files.
I think it is slightly different than the indicated duplicate Becuse i changed the permissions on the files too. Also if i run chown root:root /etc/ it will give me chown root:root /etc chown: changing ownership of '/etc': Operation not permitted