Restaurar permessões de arquivos / pastas do sistema padrão

2

Então eu acidentalmente digitei: sudo chmod a-wrx /etc e desde que o etc contenha sudeors.d e muitas outras coisas importantes, eu não pude logar / logar ou executar nenhuma tarefa de administração.
Eu carreguei o GRUB e fui root a partir daí, eu fiz:

chmod a+wrx /etc  

e, finalmente, logado na máquina, mas agora está confuso (não é possível desligar corretamente, olhar mudou, etc ...).

Como faço para restaurar as permissões padrão para etc (ou qualquer sistema de arquivos) que vieram com a instalação ( sem reinstalar o sistema )?

    
por egy 08.08.2014 / 02:32

2 respostas

2

No link que postei nos comentários, há um comando para criar um arquivo com permissões. Eu executei na minha máquina e peguei isso.

  1. 1º faça isso: link
  2. Adicione esses comandos a um script (copie / cole; nomeie-o como restoreetc.sh , torne-o executável ( chmod 775 restoreetc.sh ) e execute-o ( gksudo restoreetc.sh ):
chmod a+x /etc/grub.d/20_linux_xen
chmod a+x /etc/grub.d/41_custom
chmod a+x /etc/grub.d/20_memtest86+
chmod a+x /etc/grub.d/00_header
chmod a+x /etc/grub.d/30_uefi-firmware
chmod a+x /etc/grub.d/10_linux
chmod a+x /etc/grub.d/40_custom
chmod a+x /etc/grub.d/05_debian_theme
chmod a+x /etc/grub.d/30_os-prober
chmod a+x /etc/gtk-3.0/settings.ini
chmod a+x /etc/brltty/latex-access.ctb
chmod a+x /etc/security/namespace.init
chmod a+x /etc/dhcp/dhclient-exit-hooks.d/zzz_avahi-autoipd
chmod a+x /etc/dhcp/dhclient-enter-hooks.d/avahi-autoipd
chmod a+x /etc/dhcp/dhclient-enter-hooks.d/samba
chmod a+x /etc/resolvconf/update-libc.d/avahi-daemon
chmod a+x /etc/resolvconf/update.d/libc
chmod a+x /etc/resolvconf/update.d/dnscache
chmod a+x /etc/mysql/debian-start
chmod a+x /etc/X11/xinit/xserverrc
chmod a+x /etc/X11/Xreset
chmod a+x /etc/X11/Xsession
chmod a+x /etc/dkms/template-dkms-mkdeb/debian/prerm
chmod a+x /etc/dkms/template-dkms-mkdeb/debian/postinst
chmod a+x /etc/dkms/template-dkms-mkdeb/debian/rules
chmod a+x /etc/wpa_supplicant/ifupdown.sh
chmod a+x /etc/wpa_supplicant/functions.sh
chmod a+x /etc/wpa_supplicant/action_wpa.sh
chmod a+x /etc/acpi/thinkpad-radiosw.sh
chmod a+x /etc/acpi/powerbtn.sh
chmod a+x /etc/acpi/fglrx-powermode.sh
chmod a+x /etc/acpi/asus-keyboard-backlight.sh
chmod a+x /etc/acpi/asus-wireless.sh
chmod a+x /etc/acpi/tosh-wireless.sh
chmod a+x /etc/acpi/ibm-wireless.sh
chmod a+x /etc/acpi/undock.sh
chmod a+x /etc/network/if-post-down.d/wireless-tools
chmod a+x /etc/network/if-pre-up.d/wireless-tools
chmod a+x /etc/network/if-pre-up.d/ethtool
chmod a+x /etc/network/if-up.d/avahi-autoipd
chmod a+x /etc/network/if-up.d/upstart
chmod a+x /etc/network/if-up.d/avahi-daemon
chmod a+x /etc/network/if-up.d/ethtool
chmod a+x /etc/network/if-up.d/000resolvconf
chmod a+x /etc/network/if-up.d/ntpdate
chmod a+x /etc/network/if-down.d/resolvconf
chmod a+x /etc/network/if-down.d/avahi-autoipd
chmod a+x /etc/network/if-down.d/upstart
chmod a+x /etc/smartd_warning.sh
chmod a+x /etc/init.d/sudo
chmod a+x /etc/init.d/dbus
chmod a+x /etc/init.d/brltty
chmod a+x /etc/init.d/cpufreqd
chmod a+x /etc/init.d/rcS
chmod a+x /etc/init.d/umountroot
chmod a+x /etc/init.d/saned
chmod a+x /etc/init.d/console-setup
chmod a+x /etc/init.d/unattended-upgrades
chmod a+x /etc/init.d/resolvconf
chmod a+x /etc/init.d/mysql
chmod a+x /etc/init.d/vboxautostart-service
chmod a+x /etc/init.d/single
chmod a+x /etc/init.d/loadcpufreq
chmod a+x /etc/init.d/rsync
chmod a+x /etc/init.d/apport
chmod a+x /etc/init.d/udev
chmod a+x /etc/init.d/urandom
chmod a+x /etc/init.d/dns-clean
chmod a+x /etc/init.d/bluetooth
chmod a+x /etc/init.d/vboxweb-service
chmod a+x /etc/init.d/killprocs
chmod a+x /etc/init.d/apparmor
chmod a+x /etc/init.d/lightdm
chmod a+x /etc/init.d/cups
chmod a+x /etc/init.d/rc
chmod a+x /etc/init.d/kmod
chmod a+x /etc/init.d/grub-common
chmod a+x /etc/init.d/vboxdrv
chmod a+x /etc/init.d/atieventsd
chmod a+x /etc/init.d/umountnfs.sh
chmod a+x /etc/init.d/rc.local
chmod a+x /etc/init.d/rsyslog
chmod a+x /etc/init.d/smartmontools
chmod a+x /etc/init.d/avahi-daemon
chmod a+x /etc/init.d/networking
chmod a+x /etc/init.d/bootchart
chmod a+x /etc/init.d/pulseaudio
chmod a+x /etc/init.d/pppd-dns
chmod a+x /etc/init.d/procps
chmod a+x /etc/init.d/tlp
chmod a+x /etc/init.d/halt
chmod a+x /etc/init.d/speech-dispatcher
chmod a+x /etc/init.d/anacron
chmod a+x /etc/init.d/umountfs
chmod a+x /etc/init.d/cpufrequtils
chmod a+x /etc/init.d/sendsigs
chmod a+x /etc/init.d/reboot
chmod a+x /etc/init.d/ondemand
chmod a+x /etc/init.d/x11-common
chmod a+x /etc/init.d/vboxballoonctrl-service
chmod a+x /etc/init.d/acpid
chmod a+x /etc/init.d/irqbalance
chmod a+x /etc/init.d/cups-browsed
chmod a+x /etc/init.d/kerneloops
chmod a+x /etc/pm/sleep.d/10_grub-common
chmod a+x /etc/pm/sleep.d/10_unattended-upgrades-hibernate
chmod a+x /etc/pm/sleep.d/novatel_3g_suspend
chmod a+x /etc/ppp/ipv6-down
chmod a+x /etc/ppp/ip-up.d/0dns-up
chmod a+x /etc/ppp/ip-up.d/0000usepeerdns
chmod a+x /etc/ppp/ip-up.d/000resolvconf
chmod a+x /etc/ppp/ip-down.d/0000usepeerdns
chmod a+x /etc/ppp/ip-down.d/0dns-down
chmod a+x /etc/ppp/ip-down.d/000resolvconf
chmod a+x /etc/ppp/ip-down
chmod a+x /etc/ppp/pppoe_on_boot
chmod a+x /etc/ppp/ipv6-up
chmod a+x /etc/ppp/ip-up
chmod a+x /etc/rmt
chmod a+x /etc/rc.local
chmod a+x /etc/cron.daily/0anacron
chmod a+x /etc/cron.daily/man-db
chmod a+x /etc/cron.daily/upstart
chmod a+x /etc/cron.daily/apport
chmod a+x /etc/cron.daily/update-notifier-common
chmod a+x /etc/cron.daily/cracklib-runtime
chmod a+x /etc/cron.daily/passwd
chmod a+x /etc/cron.daily/mlocate
chmod a+x /etc/cron.daily/bsdmainutils
chmod a+x /etc/cron.daily/popularity-contest
chmod a+x /etc/cron.daily/dpkg
chmod a+x /etc/cron.daily/apt
chmod a+x /etc/cron.daily/logrotate
chmod a+x /etc/smartmontools/run.d/10mail
chmod a+x /etc/smartmontools/run.d/10powersave-notify
chmod a+x /etc/NetworkManager/dispatcher.d/99tlp-rdw-nm
chmod a+x /etc/NetworkManager/dispatcher.d/01ifupdown
chmod a+x /etc/apm/event.d/20hdparm
chmod a+x /etc/apm/event.d/anacron
chmod a+x /etc/apm/scripts.d/alsa
chmod a+x /etc/update-motd.d/91-release-upgrade
chmod a+x /etc/update-motd.d/98-fsck-at-reboot
chmod a+x /etc/update-motd.d/10-help-text
chmod a+x /etc/update-motd.d/98-reboot-required
chmod a+x /etc/update-motd.d/00-header
chmod a+x /etc/update-motd.d/90-updates-available
chmod a+x /etc/cron.weekly/0anacron
chmod a+x /etc/cron.weekly/man-db
chmod a+x /etc/cron.weekly/fstrim
chmod a+x /etc/cron.weekly/update-notifier-common
chmod a+x /etc/cron.weekly/apt-xapian-index
chmod a+x /etc/avahi/avahi-autoipd.action
chmod a+x /etc/cron.monthly/0anacron
chmod a+x /etc/kernel/postinst.d/zz-update-grub
chmod a+x /etc/kernel/postinst.d/dkms
chmod a+x /etc/kernel/postinst.d/pm-utils
chmod a+x /etc/kernel/postinst.d/apt-auto-removal
chmod a+x /etc/kernel/postinst.d/initramfs-tools
chmod a+x /etc/kernel/header_postinst.d/dkms
chmod a+x /etc/kernel/postrm.d/zz-update-grub
chmod a+x /etc/kernel/postrm.d/initramfs-tools
chmod a+x /etc/kernel/prerm.d/dkms
chmod a+x /etc/pcmcia/comedi
chmod a+x /etc/ca-certificates/update.d/jks-keystore
    
por Rinzwind 08.08.2014 / 02:49
0

Para obter o ssh em execução, você também precisa executar

chmod 400 /etc/ssh/ssh*key

e

service ssh restart
    
por podarok 02.11.2016 / 13:19