5

All linux users out there is there a way to protect from "rm -rf" scenario if your friend knows your linux password

Comments
  • 10
    Change your password?
  • 1
    I know that but if I don't wanna change but still protect system, like any way to create an alias?@Fiftyseven
  • 0
    If you're not sharing machines, you could add ip restrictions, or set up/change ssh keys.
  • 0
    Its just my personal laptop@Fiftyseven
  • 0
    Then if nothing could be done then trust is all we got, is it?@Fiftyseven
  • 3
    You could create a new user (with a different password), and revoke the sudo access for the current one.
    The simplest way would still be to change your password, is that definitely not an option?
  • 0
    Oh yeah that's definitely an option, thanks for your input@Fiftyseven
  • 3
    If he has physical access nothing can protect you. Boot init=/bin/bash and you're done
  • 0
    Alias the command to simply echo out what they passed in.
  • 0
    It didn't work when i tried@mortanius
  • 2
    In your bash profile you are putting something like:

    alias rm="echo" ?

    You could install a trash package an alias as that instead, but I don't think that's what you want though you can undo deletes then.
  • 1
    Have your work always in some repository like git, svn etc and then follow 3+2+1 backup rule. This use case is typical disaster management which covers another scenarios say your hard disk fried one day.
  • 0
    Are you sure that you can't just
    alias rm -rf='echo eat my shit'
    And then . ~/.bashrc or source ~/.bashrc?
  • 1
    I tried to change alias for rm, it didn't work, so I didn't test for rm -rf@RAZERZ
  • 0
    Create a shell script rm.sh which eats the shit thing and accepts all parameters
  • 1
    man chattr
  • 0
    Move the rm binary somewhere else, and put a shell script in it's place. Check if the arguement is /, otherwise point it to the real rm. If it's actually rm -rf /, print out some insults. I don't recommend testing it though.
    Good luck.
  • 0
    Nice idea but who will try?😄I guess we can try in vmWare@dhruvitr
Add Comment