Welcome to Centmin Mod Community
Register Now

Sysadmin rm -rf

Discussion in 'System Administration' started by elargento, Feb 28, 2018.

  1. elargento

    elargento Member

    332
    17
    18
    Jan 4, 2016
    Ratings:
    +42
    Local Time:
    4:06 AM
    10
    Yes.... I just run rm -rf /* and I f*** up my centminmod installation. :banghead:

    Maybe not a good idea to force, right?
     
  2. eva2000

    eva2000 Administrator Staff Member

    34,598
    7,653
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,770
    Local Time:
    5:06 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ouch the biggest danger and argument of running at root user though root user is needed for centmin mod. What directory were you intending the files to be deleted from ?

    You should always change into directory you want to delete + use full path rather than relative path if you forcing a delete on wildcards like * so if you want to delete all stuff from /home/directoryname/ + use pwd to verify the directory you're in. So you would use
    Code (Text):
    cd /home/directoryname
    pwd
    rm -rf /home/directoryname/*
    
     
    • Informative Informative x 2
  3. Revenge

    Revenge Active Member

    398
    84
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +297
    Local Time:
    8:06 AM
    1.9.x
    10.1.x
    Everyone makes a mistake at least one time... At least i think so.

    My biggest mistake was running the command below. At the moment i clicked enter, i did know i was f*cked...

    Code:
    chown admin:admin / 
     
    • Like Like x 1
  4. eva2000

    eva2000 Administrator Staff Member

    34,598
    7,653
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,770
    Local Time:
    5:06 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    At least it was chown only on that directory and not a recursive chown like chown -R admin:admin / applying it on all subdirectories heh.

    Yeah for chown, like rm -rf I always use full paths and change into the directory I intend to run the commands on - I made it habit and don't really think just do :)
    Code (Text):
    cd /home/directoryname
    pwd
    chown -R nginx:nginx /home/directoryname/
    
     
    • Informative Informative x 1
  5. Revenge

    Revenge Active Member

    398
    84
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +297
    Local Time:
    8:06 AM
    1.9.x
    10.1.x
    Sorry, i forgot the -R, it was recursive. The only solution was to format the vps. I even lost SSH access.

    That's why its really important to have external backups, which fortunately was the case.

    Ya, that's the best practice. We should also not use root, but normally we are so confident in ourselves, that its just easier to use a root user.
     
    • Informative Informative x 1
  6. upgrade81

    upgrade81 Premium Member Premium Member

    130
    6
    18
    Sep 5, 2016
    Italy
    Ratings:
    +8
    Local Time:
    9:06 AM
    1.13.8
    10
    It happened to me too.
    what did you use for the backup? Were all the data of the sites with the external backup synchronized at the time of the disgrace? @Revenge

    fortunately I have a vps and then I have kvn.
     
    Last edited: Mar 10, 2018
  7. Revenge

    Revenge Active Member

    398
    84
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +297
    Local Time:
    8:06 AM
    1.9.x
    10.1.x
    I have an automated full backup per day, so i lost a couple of hours on that vps(its only 1 site), but nothing critical.
     
..