Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: all files in /home/user/ vanished (deleted?)

  1. #1

    Default all files in /home/user/ vanished (deleted?)

    Hi,
    so well, except for 6 directories, all other files and directories in my /home/user/ directory are just gone. The mentioned 6 directories have their change time set to the exact same time, but are empty (all files in this folders are also gone).

    What I did:
    on desktop1 I opened dolphin in one of my dirs, rightlicked a scriptfile (few lines, containing some echos, scaimage and convert), picked "open with Kate". I have Kate already opened with a simple textfile on desktop2. KDE switches to desktop2 and kate, shows the file, but it is empty... (which should not be). At first I thought I opened the wrong file, switched by to desktop1 and... the dir opened in Dolphin was empty. Then I saw the Desktop and it is also empty... all files linked to there just gone.
    Then I opened a terminal, using cd ~ and ls -l and... everything is gone, except for 6 directories, which on the other side, are empty as well now.

    Since I am not a linux expert, I have not the slightest idea where to start looking/troubleshooting (and find all the files, that are gone).

    Hope someone can point me in the right direction (I gues the files are for some reason just not visible, ls -la is not helping, because firefox have still all its settings and bookmarks and the profile-dir is also located in /homer/user/)

  2. #2

    Default Re: all files in /home/user/ vanished (deleted?)

    edit: skip the last sentence, I just noticed all the "hidden" folders and files were not touched and firefox settings are in /home/user/.mozilla

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,240

    Default Re: all files in /home/user/ vanished (deleted?)

    I assume that the directory name user you use above in /home/user/ is the username of the user that is loged in and that is having the problem? (giving a user the name user isn't making things vvery clear imho ).

    And is the assumption correct that
    Code:
    ls -la $HOME
    shows that all directories/files where the name starts with a . (dot) are still there?
    Henk van Velden

  4. #4

    Default Re: all files in /home/user/ vanished (deleted?)

    user = general, of course for me its /home/mla/ sorry
    ls -la $HOME
    shows all hidden files, all hidden directories (the contents of the hidden directories are still there), and it shows 6 non-hiddden directories, which are empty

  5. #5
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: all files in /home/user/ vanished (deleted?)

    Quote Originally Posted by mlarue View Post
    on desktop1 I opened dolphin in one of my dirs, rightlicked a scriptfile (few lines, containing some echos, scaimage and convert)
    Said script wouldn't have contained any rm commands or similar that may have accidentally had the wrong path?
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  6. #6

    Default Re: all files in /home/user/ vanished (deleted?)

    the last line of the script was(is)

    Code:
    rm /RAMDISK/*.pnm
    If, for whatever reason, openSUSE executed the script while opening it in a texteditor, and if the rm command parameters were ignored (targetdir and actualy not recursively), then the question is, how do I recover the deleted file? I doubt it is as easy as in windows.

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,240

    Default Re: all files in /home/user/ vanished (deleted?)

    I was also thinking along the same lines as Miuku.

    But when you only shhow one line of your script, that will not help much when others should analyze it. Remember that you NOT seeing where it goes "wrong" does not mean that others wouldn't see it. The writer/owner/maintainer of a program always has some blindness in running through the same loop agian and again. A fresh eye/mind will then probably see things.

    Analyzing those 6 names that are still ther might be interesting also.

    And for your deleted files, restoring them from your (or the systems) backup is the fatstest way.
    Henk van Velden

  8. #8
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: all files in /home/user/ vanished (deleted?)

    The reason I asked you about the rm is because even a space in the command in the wrong place may accidentally execute it in your "default path" (which would be your home).

    Also, did the command have any move commands that could have moved the files to another location, such as /tmp ?

    You've (without a doubt?) checked Trashcan already?

    There are ways to recover data from ext4, such as Testdisk or extundelete but under no circumstance should you write anything to the drive as it may overwrite the data you are trying to recover.
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  9. #9

    Default Re: all files in /home/user/ vanished (deleted?)

    Quote Originally Posted by Miuku View Post
    The reason I asked you about the rm is because even a space in the command in the wrong place may accidentally execute it in your "default path" (which would be your home).
    [...]
    Now that explains a lot, thanks! If the script got somehow executed by accident, the parameters were missing (blanks?) and thus could delete the default path, line 21? (could recover the script, sorry no linux expert and only had to remember the script from last time I saw it, ... well, already (hours ago) unmounted the device in question, and making it suffer from dd and ext4magic.

    here the script

    Code:
    #!/bin/bash
    #v1.1
    
    umask 0000
    
    #parameter
    COLOR=${1}
    X=${2}
    Y=${3}
    DPI=${4}
    SCANNERDEVICE=${5}
    DUPLEX=${6}
    CONTINUOUS=${7}
    QUALITY=${8}
    TMPDIR=${9}
    FILENAME=${10}
    
    PAGELAYOUT="-x $X -y $Y "
    
    rm -r $TMPDIR/* > /dev/null 2>&1
    
    echo "Farbtiefe: $COLOR"
    echo "X+Y: $PAGELAYOUT"
    echo "DPI: $DPI"
    echo "SCANNER: $SCANNERDEVICE"
    echo "fortlaufend: $CONTINUOUS"
    echo "Qualitaet: $QUALITY"
    echo "Temporaerer Dateiordner: $TMPDIR"
    echo "Dateiname: $FILENAME"
    echo ""
    
    case $CONTINUOUS in
        1)
        BATCHCOUNT=""
        ;;
        0)
        case $DUPLEX in
            1)
            BATCHCOUNT="--batch-count=2"
            ;;
            0)
            BATCHCOUNT="--batch-count=1"
            ;;
        esac
        ;;
    esac
    
    case $DUPLEX in
        1)
        echo "duplex"
            echo "scanimage --mode $COLOR $PAGELAYOUT --resolution $DPI -d $SCANNERDEVICE --batch=$TMPDIR$FILENAME-%02d.pnm --batch-start=1 $BATCHCOUNT --source ADF Duplex"
        scanimage --mode $COLOR $PAGELAYOUT --resolution $DPI -d "$SCANNERDEVICE" --batch="$TMPDIR$FILENAME-%02d.pnm" --batch-start=1 $BATCHCOUNT --source "ADF Duplex"
        ;;
        0)
        echo "simplex"
            echo "scanimage --mode $COLOR $PAGELAYOUT --resolution $DPI -d $SCANNERDEVICE --batch=$TMPDIR$FILENAME-%02d.pnm --batch-start=1 $BATCHCOUNT"
        scanimage --mode $COLOR $PAGELAYOUT --resolution $DPI -d "$SCANNERDEVICE" --batch="$TMPDIR$FILENAME-%02d.pnm" --batch-start=1 $BATCHCOUNT
        ;;
    esac
    
    for i in `ls $TMPDIR`
        do
        zaehler=`echo $i | cut -d "-" -f2`
        zaehler=`echo $zaehler | cut -d "." -f1`
        suffix=".jpg"
        echo "Konvertiere Datei=$FILENAME-$zaehler.pnm zu $FILENAME-$zaehler$suffix"
        #convert -quality $QUALITY -resize 826x1100 "$TMPDIR$FILENAME-$zaehler.pnm" "$TMPDIR$FILENAME-$zaehler.jpg"
        convert -quality $QUALITY "$TMPDIR/$FILENAME-$zaehler.pnm" "$TMPDIR$FILENAME-$zaehler.jpg"
            #convert -unsharp 0x1 "$TMPDIR$FILENAME-$zaehler.jpg"
        echo "loesche Datei=$FILENAME-"$zaehler".pnm"
            rm $TMPDIR/$FILENAME-$zaehler.pnm
    done

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,240

    Default Re: all files in /home/user/ vanished (deleted?)

    Well,
    Code:
    rm -r $TMPDIR/* > /dev/null 2>&1
    looks rather dangerous to me.

    When you like to go for serious programming, then you must learn that cheking all parameters comming from outside is a very important security thing to do. IMHO a high percentage of cracking is due to sloppy testing of parameters.

    Be glad you did not run this while being the Superuser.
    Henk van Velden

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •