Uh oh I chmod -R 777 /
Tech Notes
Uh oh I chmod -R 777 /
ssh won't let me in, i can't su or sudo from console. I've logged in as a regular user.
- JOB: Get root METHOD: Check for available cron.d tasks
username@chief:~$ ls -la /etc/cron.d total 32 drwxrwxrwx 3 root root 4096 2010-05-24 04:17 . drwxrwxrwx 102 root root 8192 2010-05-24 04:55 .. -rwxrwxrwx 1 root root 456 2010-05-24 04:17 php4
Oh good. Add a line into php4 cron job - it runs once a minute, copies a shell to tmp and makes it executable. Don't forget to disable the job and remove the shell when you're finished.username@chief:~$ cat /etc/cron.d/php4 | grep sh */1 * * * * root cp /bin/sh /tmp/sh; chmod 4755 /tmp/sh
enter that shellusername@chief:/root$ cd username@chief:~$ /tmp/sh sh-3.1# whoami root
- fix some things and tidy up
chief:~# chmod 0600 /var/run/sshd /etc/ssh/ssh_host_* chief:~# chmod 4755 /bin/su /usr/bin/sudo chief:~# chmod 0440 /etc/sudoers chief:~# chmod 0700 /var/run/sudo/ chief:~# /etc/init.d/ssh start chief:~# rm /tmp/sh
- fix apt-get
chief:~# apt-get install [anypackage] Reading package lists... Done Building dependency tree... Done You might want to run ‘apt-get -f install’ to correct these: The following packages have unmet dependencies. libavcodec52: Depends: libavutil49 (>= 4:0.5+svn20090706) but it is not going to be installed or libavutil-extra-49 (>= 4:0.5+svn20090706) but it is not installablechief:~# dpkg -l | grep libavutilcvs49
chief:~# dpkg -r ffmpeg chief:~# dpkg -r libavcodeccvs51 chief:~# dpkg -r libavutilcvs49 chief:~# apt-get -f install