Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Huh, what do you know. I thought modern rm only protected against deleting / by absolute path, but it looks like it'll protect you from deleting your parent regardless:

    $ docker run --rm -ti debian:11  # sandbox the danger...
    root@c70dde9f38a3:/# cd /tmp
    root@c70dde9f38a3:/tmp# rm -rf ./.
    rm: refusing to remove '.' or '..' directory: skipping './.'
    root@c70dde9f38a3:/tmp# mkdir -p /tmp/1/2/3/4/5
    root@c70dde9f38a3:/tmp# cd /tmp/1/2/3/4/5
    root@c70dde9f38a3:/tmp/1/2/3/4/5# rm -rf ./.
    rm: refusing to remove '.' or '..' directory: skipping './.'


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: