Proprietário alterado da pasta / etc, não pode mais usar o sudo

3

Eu mudei o proprietário da pasta / etc por acidente quando estava trabalhando no servidor web e agora proprietário da pasta / etc e todos os seus subdiretórios são www-data. Eu não posso mais usar o sudo para nada e no console do modo de recuperação é reiniciado após 30 segundos e então ele congela. Existe alguma maneira de eu corrigir isso sem reinstalar o Ubuntu.

    
por Dvorsky 22.06.2016 / 13:17

1 resposta

9

Talvez pesquisar um pouco mais: link

Reboot, hold down right shift key to bring up the grub2 boot menu. Then follow these instructions to enter single user mode.

How do I boot into single user mode from grub?

In single user mode you can fix the file permissions because you are automatically the root user.

Generally speaking, if it's just the file ownership that changed. You can run:

chown -R root:root /etc

That will change ownership and group back to the default root.

I have an ubuntu server 12.04 LTS here and there are a small number of files/directories beneath /etc that have a different group ownership. Aside from this, all files are owned by root. The files with the different group ownership are:

/etc:
-rw-r----- 1 root daemon   144 Oct 26  2011 at.deny
drwxr-s--- 2 root dip     4096 Aug 22 12:01 chatscripts
-rw-r----- 1 root shadow   697 Oct 31 12:58 gshadow
-rw-r----- 1 root shadow  1569 Oct 31 13:00 shadow

/etc/chatscripts:
-rw-r----- 1 root dip  656 Aug 22 12:01 provider

So you can run the chgrp command on those files after initially running chown first. Then you should have everything restored back to how it should be. It shouldn't take an average user more than 10mins.

e.g. 
  chgrp shadow /etc/shadow

Oh and one final step. After you've done the changes reboot.

/> reboot
    
por 22.06.2016 / 13:51