File hiding method under Liunx

File hiding method under Liunx

Disclaimer: The following hidden introductions are only suitable for learning and authorized operations. Please do not use them in illegal environments!

Preface: There is no absolute hiding in the world

Hello friends, long time no see. Today I will show you some of the methods we use to hide files on the intranet.

In Linux systems, there are generally 7 methods of hiding files. Next, we will explain them one by one.

  • Add "." before the file name
    This is the simplest way to insert a code piece here. Just add a dot before the target file name. For example, if you want Hide files named "secret.txt" and simply rename them ".secret.txt".

    mv secret.txt .secret.txt
    

    Or you can also try to use thetouch command to create a new one as follows:

    touch .secret.txt
    

    Note: This method can still be viewed using thels -a command

  • Modify file attributes
    Use the chattr command to modify the file attributes. Among them, use the "+i" option to set the file It is an unmodifiable attribute, so that other users cannot modify or delete the file, thereby achieving a hidden effect.

    chattr +i secret.txt          # 设置为不可修改
    chattr -i secret.txt           # 恢复文件的可修改属性状态
    

    Insert image description here

    Please note: root privileges are required to use the chattr command.

  • Nested Hiding
    Steganography is the practice of embedding one file within another, thereby hiding the information within it. We will use the steghide tool as an example, first make sure it is installed: steghide

    sudo apt-get install steghide
    

    Next, assume that we have two files, one is the image file "cover.jpg", and the other is the file to be hidden "hidden.txt". First, put them in the same directory. Then, use the following command to hide "hidden.txt" in "cover.jpg":

    steghide embed -cf cover.jpg -ef hidden.txt
    

    This command will prompt you for a password to encrypt the hidden files. Once completed, a new image file will be generated containing the hidden files.

    To extract hidden files, use the following command:

    steghide extract -sf cover.jpg
    

    The system will prompt you to enter the password you set previously and extract "hidden.txt" to the current directory.

  • Hide file creation time
    The function of hiding file time is to confuse the other party and add the time of the file to the previous time, or the same time of other files

    touch -r current .123.txt         # 将current的时间给到.123.txt这样就可以做到迷惑对方了
    

    Insert image description here

  • Hide through permissions
    In some cases, some server administrators do not have root permissions. In this case, we can set permissions through the chmod command. method to hide

    mkdir test           # 创建test目录
    chmod 700  test    # 设置文件夹权限,除该文件拥有者以外,其他用户无法访问
    cd test && touch .555.txt && chmod 600 .555.txt       # 进入test文件,创建555.txt并设置600的权限
    

In this way, other users will not have the right to view the contents of the test file.


Guess you like

Origin blog.csdn.net/m0_55994898/article/details/132062372