Do Not Allow Executable Hidden Files
In Linux, files starting with a dot (.) are typically hidden files (excluding the current directory . and parent directory ..). Executable hidden files are not allowed in the system and must be deleted or have their execute permissions removed.
.bashrc, .bash_profile, and .bash_logout are startup/shutdown shell scripts generated upon user account creation. These files comply with industry conventions and should be retained.
Procedure
- Run the find command to search for executable hidden files. The following example performs a global search under the root directory.
find / -type f -name "\.*" -perm /+x
The following is an example. If the command returns no output, no executable hidden files exist. Otherwise, the corresponding files are listed.
/etc/skel/.bashrc /etc/skel/.bash_profile /etc/skel/.bash_logout
- If any executable hidden files are found, use one of the following three methods to fix the issue (using .testfile as an example):
- Run the rm command to remove the hidden executable files:
rm .testfile
- Run the mv command to change the hidden files to regular files:
mv .testfile testfile
- Run the chmod command to remove its execute permission.
chmod 644 .testfile
- Run the rm command to remove the hidden executable files:
Parent topic: Manual Configuration Items