I accidentally moved my /bin directory to /usr/bin/bin, anyway, I managed to move it back to its place with # /usr/bin/bin/mkdir /bin# /usr/bin/bin/mv /usr/bin/bin /and then I was able to login as root, but I wasn't able to su from my user, it gave me an authentication error. I ran chmod +s /bin/su and chmod u+s /bin/su as root, and it fixed it.another thing I noticed is that I can't ping either; it gives me this error:$ ping 192.168.1.1ping: icmp open socket: Operation not permittedand this is my ping file:-rwxr-xr-x 1 root root 44K Jun 30 20:38 /bin/pingI guess I messed up all the permissions and SGID on my /bin folder. Is there any way to fix this? (other than formatting)Just for the record, I'm using a 64 bit Debian 8.
accidentally moved and fixed /bin/ directory, but now can't su
linux;permissions
I would debootstrap a base system to another directory.debootstrap --variant=minbase --arch=amd64 jessie /tmp/bootstrap http://ftp.us.debian.org/debian/Then copy all files from /tmp/bootstrap/bin to /bin keeping the permissions.cp -a /tmp/bootstrap/bin/* /bin/Now many (and the basic ones) of your files in /bin should be ok and you should be able to see which were not touched using the timestamp (old files can have wrong permissions).For the rest you can useapt-get install --reinstall PACKAGEto set the permissions back.You can find the package to a file withdpkg -S /path/to/fileThis is even scriptable...Good luck!