I have created two types of users, one is admin and another is a standard user.
ctrl+H is the shortcut to see hidden files in most of the linux file managers.
I want to disable that option for standard user. When a standard user tries to unhide files then the system won't do anything, just disable the hide and unhide options.
My primary goal is when any standard user press ctrl+H then system not show hidden files to standard user.
Secondary goal is there is no any other option to see hidden files for standard user.
I only concentrate to only revoke from seeing hidden files because making hidden files are easy and time saving as compare to make separate permission for each folder. Managing separate permissions for each folder is time consuming and sophisticated task and Also we need root privilege to manage permission or edit permission, I want to avoid many times calling for Root. Also when managing permission many times we confuse between system files/folder also there is probability to making any silly mistake during manage special permissions as per each folder/file.
In simple words I want revoke access of files which names are starting with .
dot
Your last comment says, you actually wanted to prevent users from seeing all hidden files (those starting with
.
). This is not possible in Linux and this will never going to help in security.Because Linux uses .hidden files almost everywhere, even a users shell configuration is stored in hidden files (such as
.bashrc
,.zshrc
etc). If you remove the read permission from it, all users settings will be removed.Take another example. Firefox uses
.mozilla
directory for a user in their home. If you remove read permission, firefox will not function normally. You can remove execution bit from the directory, but it won't prevent users seeing the name of the .mozilla directory, though they can't access further.You might be thinking that the purpose of those .hidden files are security, but it isn't. The main goal of not showing files/dirs starting with
.
is cleanliness. The thought was a user only need to see those files who s/he uses regularly.So, the only way to revoke standard users' seeing permission is, using Linux standard permission settings. See these questions
Setting Read/Write/Execute Permissions in Linux
How do I set executable permissions on a removable drive?
Change folder permissions and ownership
Prevent Ctrl-H from showing hidden files.
If you want to still prevent users from using Ctrl-H, you can apply a trick. Setting a bogus command for that same keyboard shortcut.
To do so in Unity, Go to the System Settings -> Keyboard. In the Shortcut tab, click Custom Shortcut and then the + button. Set anything as the
name
field and in thecommand
use/bin/bash -c "echo"
. Click apply.Then click on the shortcut name at the right end and press Ctrl-H. This will override the shortcut and you can't see hidden files by using shortcut.
Note As I already said, this will not prevent users from seeing hidden files by using menu options or other means.