You are not logged in.

#1 2008-10-14 18:46:52

Verminoz
Member
From: Greece
Registered: 2008-08-17
Posts: 47
Website

Problem with /bin and /etc permissions

Hello,
Due to previous problems I was trying to chroot into my system and during that process I thought there were permission problems, so I crapped up the permissions in /bin and /etc. After that all sorts of problems arose concerning permissions.

How can I change the permissions back to what they're supposed to be? They are currently all 777 (-rwxrwxrwx)...
What about /etc/sudoers and /etc/groups?


Ohne Musik ware das Leben ein Irrtum

Offline

#2 2008-10-14 21:08:47

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Problem with /bin and /etc permissions

You're probably best off telling pacman to dump the list of packages you've got installed, and then reinstalling all of them. You'll want to boot off another disk/CD/USB key, then chroot to the busted partition, then do whatever you need to get pacman to dump and reinstall this stuff.

But if you want to live dangerously, here are some commands that will bring your /bin and /etc directories in line with the ones I've got on this machine. (Not too much installed here, but you may still find that I've got some things installed that you don't, so if you get "file not found" errors just delete the offending filenames.) Best way to do this is to boot off that other disk/CD/USB key, then DON'T chroot, but instead replace the references to /etc and /bin below with references to your problem /bin and /etc wherever you've got them mounted. That way, you can use the chmod, sudo etc binaries on the non-broken disk/CD/USB key to effect these changes.

sudo chown -R root:root /bin /etc
sudo chmod -R 755 /bin
sudo chmod u-w /bin/{bashbug,kill,ps,traceroute,su}
sudo chmod u+s /bin/{mount,umount,ping,ping6,traceroute6,fusermount,traceroute,su}

sudo find /etc -type f -exec sudo chmod 644 \{\} \;
sudo find /etc -type d -exec sudo chmod 755 \{\} \;

sudo chmod 440 /etc/sudoers

for f in /etc/rc.d/* /etc/openvpn/examples/*.{up,sh} /etc/profile.d/* /etc/ssl/misc/* /etc/ppp/{ip-down,ip-up,plugins/rp-pppoe.so} /etc/rc.[lms]* /etc/security/namespace.init /etc/skel/.x* ;  do
    [[ -f $f ]] && sudo chmod a+x $f
done

for f in /etc/.pwd.lock /etc/ppp/*ap-secrets /etc/*shadow* /etc/passwd- /etc/group- /etc/crypttab /etc/cups/printers.conf; do
    [[ -f $f ]] && sudo chmod 600 $f
done

sudo chmod 640 /etc/cups/{cupsd.conf.default,snmp.conf,cupsd.conf} /etc/msmtprc
sudo chmod 744 /etc/cron.daily/*

sudo chown root:lp /etc/cups/{cupsd.conf.default,snmp.conf}
sudo chown root:nobody /etc/cups/{cupsd.conf,printers.conf}

Offline

Board footer

Powered by FluxBB