Operatin not permitted - SSH as root, trying to delete files



  • I sshed into my pfsense box a root and untarred a pfsense backup that was in the root directory to see if it was just an .xml or the whole thing. Turned out it was the whole thing and now my root directory is filled with what would be found on /

    I tried deleting some files but I am getting

    rm: boot/loader.rc: Operation not permitted
    rm: boot/: Directory not empty
    rm: lib/libthr.so.3: Operation not permitted
    rm: lib/libcrypt.so.5: Operation not permitted
    rm: lib/libc.so.7: Operation not permitted
    rm: lib: Directory not empty
    rm: libexec/ld-elf.so.1: Operation not permitted
    rm: libexec/: Directory not empty
    rm: sbin/init: Operation not permitted
    rm: sbin/: Directory not empty
    rm: usr/lib/librt.so.1: Operation not permitted
    rm: usr/lib: Directory not empty
    rm: usr/bin/crontab: Operation not permitted
    rm: usr/bin/su: Operation not permitted
    rm: usr/bin/opiepasswd: Operation not permitted
    rm: usr/bin/passwd: Operation not permitted
    rm: usr/bin/opieinfo: Operation not permitted
    rm: usr/bin/chsh: Operation not permitted
    rm: usr/bin/chfn: Operation not permitted
    rm: usr/bin/chpass: Operation not permitted
    rm: usr/bin: Directory not empty
    rm: usr/: Directory not empty
    
    

    Why is this? I am root user am I not? I even tried doing su - but that still did not work.


  • LAYER 8 Netgate

    I would reinstall and restore your config.xml



  • @Derelict:

    I would reinstall and restore your config.xml

    I am sorry I am not trying to be rude but I do not think you read my post correctly? I extracted that .tgz file in the /root directory, not / so all of my files in / should be fine…?



  • That would be the safest thing to do at this point, but yeah given it's limited to /root/ it's not strictly necessary. You probably need to set noschg before deleting.

    cd /root/ && chflags -R noschg *
    

    Then the rm -rf you were trying. Make sure you only do that when you're in /root/ otherwise you'll be doing the reinstall and restore. Make sure to backup your config before doing that just in case.



  • @cmb:

    That would be the safest thing to do at this point, but yeah given it's limited to /root/ it's not strictly necessary. You probably need to set noschg before deleting.

    cd /root/ && chflags -R noschg *
    

    Then the rm -rf you were trying. Make sure you only do that when you're in /root/ otherwise you'll be doing the reinstall and restore. Make sure to backup your config before doing that just in case.

    Haa haa you are great! Instead of * I just specified the few files/folders that I needed to delete and the rm -Rf command worked like a charm!

    Thanks!


Log in to reply