Don't understand german? Read or subscribe to my english-only feed.

Why you shouldn’t use copy/paste as root

Title: How to subtile fsck your Apache setup.

Solution (quoting the original command line):

cd /etc/apache2/mods-enabled
lrwxrwxrwx 1 root www-data 33 2007-09-28 15:23 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root www-data 33 2007-09-28 15:23 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root www-data 36 2007-09-28 15:23 authz_default.load -> ../mods-available/authz_default.load

Disclaimer: no, it wasn’t me; it’s the log of a customer.

Credits: thanks to monitoring and the use of mercurial in /etc locating and fixing the problem was a matter of seconds.

4 Responses to “Why you shouldn’t use copy/paste as root”

  1. Simon Huggins Says:

    I only just got up so I may have missed something but you don’t appear to have explained what the original problem was?

  2. mika Says:

    @Simon: yeah, tricky one. :) Check out the redirection “>” inside the commands (which are comming from a “ls -la” copy/paste buffer), so several *.load-files inside /etc/apache2/mods-available/ are being zeroed out. :)

    regards,
    -mika-

  3. Adam Sloboda Says:

    oh yeah, now I get it ;)

    $ lrwxrwxrwx 1 root www-data 33 2007-09-28 15:23 auth_basic.load -> ../mods-available/auth_basic.load
    zsh: file exists: ../mods-available/auth_basic.load

  4. Marc 'Zugschlus' Haber Says:

    That’s one of the reasons why su and sudo -s are forbidden in my work environment. If you use su or sudo -s, you need to use logger(1) to explain _in_ _the_ _syslog_ why that particular procedure was necessary with a root shell.

    I have established that rule when a colleague mistakenly pasted an e-mail into a root shell.