2

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

Madhav Nikam
  • 2,907
  • @sem-geologist my pc use by many users. If i create stander user for it, but stander user can't able to hide hidden files. Also I just want to revoke users to see hidden files. – Madhav Nikam Oct 28 '16 at 09:02
  • 2
    I don't get why you need that, You know that such user can just simply ls -a ? such user anyway can't reach and do anything with other users files (i.e. your files) (or even peek into if the permissions are set right). If such user is keen to destroy his home folder and his configs by messing with hidden files, it is really hard to prevent him from doing it. – sem-geologist Oct 28 '16 at 09:08
  • 2
    @MadhavNikam Standard users can hide files, simply by renaming them to start with a dot. They can also see them, by opening a terminal and doing ls -l, or pressing Ctrl-H in nautilus. What precisely is your goal: to hide complexity from standard users, or to prevent them from seeing things they aren't allowed to? – zwets Oct 28 '16 at 09:12
  • @zwets I want revoke to see hidden files from standerd user, because its time saving as compare to edit permission as per group/user or folder/files. When I make folder with special permission its time consuming and also I confuse sometimes which file/folder is from system. – Madhav Nikam Oct 28 '16 at 09:20
  • 4
    @MadhavNikam please modify your question to make clear exactly what you want to achieve. You could obviously reassign Ctrl-H to "do nothing" but then there is still the menu option View / Hidden files, the command line ls -a, and obviously they can still be opened and read by any user. What sort of files are you trying to hide? What do you want to achieve by hiding them? What is the ultimate goal you want to achieve? – zwets Oct 28 '16 at 10:05
  • You want to prevent users to see hidden files in Nautilus (the default file manager) or in every means (including file managers, command line etc)? – Anwar Oct 28 '16 at 10:35
  • @Anwar yes from command line also. – Madhav Nikam Oct 28 '16 at 10:37
  • @MadhavNikam Why are you then mentioning again and again Ctrl-H shortcut? It only prevents users from seeing hidden files from nautilus, the default file manager. But users can still see hidden files using ls -la command. – Anwar Oct 28 '16 at 10:41
  • @Anwar sorry for that, but in short I want to revoke access files which are start from dot (.) – Madhav Nikam Oct 28 '16 at 10:45

1 Answers1

3

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


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 the command 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.

Anwar
  • 76,649