1

I've a number of kiosk computer implemented my company's application which use firefox as front end user interface. All the users have to do is just staying on firefox to do their job. However when they click on firefox's "File" Menu and click open or save page as, the file dialog show up so they can explore the file system including my back end application files and mapped network drive which I seriously want to hide for security reason. I've found methods to hide those in nautilus using the .hidden file but it doesn't work in file/save dialog.

As I'm very new to Linux, I created user accounts for them as standard users and I think all user has read access to file system by default (and should they need it to make operating system and application run properly?) Then can't I take read permission out from them? Please correct me if I'm wrong.

So can i just prevent users from open file dialog? An approach i can think now is that are there any file system or library file that handle those file/save dialog? so that i can edit permission of them and the users will get permission denied dialog instead.

For example, in the case below

http://ubuntuforums.org/showthread.php?t=1363852

they remove the file: /usr/lib/gtk-2.0/2.10.0/printbackends/libprintbackend-file.so to disable "print to file" function.

And another case

https://answers.launchpad.net/ubuntu/+source/nautilus/+question/186540

they edit permission of the folder: /usr/lib/gvfs/gvfsd-smb-browse to prevent users from clicking "Browse Network" button in Nautilus.

If not possible, any suggestion to hide file system and mapped network folder in file dialog? Please help every suggestion will be appreciated. Thanks in advance.

4
  • Why don't you have the users running with an account that has no read access for the file system? Hiding with . is not a security feature, it is trivial to circumvent. I'd give you more details but this depends on how your users log in. Please edit your question and explain that.
    – terdon
    Apr 1, 2014 at 17:52
  • Thanks @terdon. As I'm very new to Linux, I created user accounts for them as standard users and I think all user has read access to file system by default (and should they need it to make operating system and application run properly?) Then can't I take read permission out from them? Please correct me if I'm wrong.
    – user264271
    Apr 2, 2014 at 2:41
  • Start your app and firefox under different user accounts.
    – user265261
    Apr 4, 2014 at 9:57
  • Smells like security by obscurity. Dec 21, 2015 at 9:42

1 Answer 1

0

The simplest way to do this is to use permissions. The permissions for files and directories on Linux and similar systems have 3 basic levels, the permissions of the file's owner, their group and everyone else.

For example, on my system, I create a new user called foo:

sudo adduser foo

This newly created user belongs to the group foo only (sudo -u foo lets me run commands as the user foo, in this case, groups which lists the groups that a user belongs to):

$ sudo -u foo groups
foo

So, let's create a file:

sudo -u foo touch /tmp/file

And have a look at its permissions:

$ ls -l /tmp/file 
-rw-r--r-- 1 foo foo 0 Apr  2 17:49 /tmp/file
---------    --- --- =================================> The file's group
 |  |  |      |=======================================> The file's owner
 |  |  ------> Others (everyone else): read only
 |  |--------> Group permissions: read only
 |-----------> Owner permissions: read/write

So, as you can see in the example above, a file has 3 levels of permissions. Since that was created as the user foo, my regular user terdon cannot write to it:

$ echo "hello" > /tmp/file
bash: /tmp/file: Permission denied

In order to list the contents of a directory a user needs read permissions and in order to move into it, they need execute permission. Therefore, to hide the contents of a directory, simply remove the read and execute rights. Taking /media as an example:

$ ls -dl /media
drwxr-xr-x 9 root root 4096 Mar 25 20:15 /media

As you can see above, the owner, the group, and everyone else all have execute rights to the directory (that's what the x means). What we want to do is make it so that only the owner and group members have access to it, so we will need to remove the read and execute rights from the "other" field:

$ sudo chmod o-rx /media
$ ls -dl /media
drwxr-x--- 9 root root 4096 Mar 25 20:15 /media

As you can see above, /media now has no execute right in the "others" field which means that only members of the group root and the user root themselves can access it.

What all this means, is that you can create users and fine tune them to have access to only specific files. However, be very careful with permissions, changing the permissions of system folders is very dangerous and should not be done. Instead, if you have specific directories you want to hide, just change their permissions and leave the system directories alone. So, in your case, if you have the backend files in /backendan d your mapped network drive somewhere in/media`, just run this command to block read access to these directories:

sudo chmod o-rx /media /foo/

For more info on how permissions can be set, see man chmod or any of the many tutorials you can find online, this one for example.

5
  • Thanks @terdon, you suggestion is very clear and useful. However if I block read access to my backend application folder, can the application work properly? As I have posted in question, the application use firefox as frontend user interface and it have to works with the backend files in system root directory. So I think the users need read access permission to the backend files.
    – user264271
    Apr 3, 2014 at 6:56
  • And (if I am right) this is the reason why I just want to close the "door" which allow user to see the files (and also structure of directory). And the "door" I mean now is the file dialog (and save dialog) that show up when users click some menu on firefox such as "open" or "save page as". So that why I need some ways to disable these dialog or some ways to hide file system in the dialog.
    – user264271
    Apr 3, 2014 at 6:59
  • Correct. If you want more granuler methods have a look at "ACL": help.ubuntu.com/community/FilePermissionsACLs
    – Rinzwind
    Apr 4, 2014 at 9:06
  • @user264271 you only block read access for the users you want. There is no reason for anyone else not to have access. To give you more details, we'd need to know how the users connect, what exactly they run, whether they need to run it or if a system user can launch it instead etc. Stopping the file=>open dialog is not enough anyway. It is a much cleaner way to simply control what your users have access to.
    – terdon
    Apr 4, 2014 at 13:53
  • @terdon After all, your answer is absolutely correct. Removing the read permission from the directory prevents users to list the contents of a directory. As a result, users cannot "list" or see the contents manually via file dialogue or nautilus but the application still can "read" them properly. Sorry, I misunderstood at first because I'm not familiar with linux permission. Thanks again terdon :)
    – user264271
    Apr 19, 2014 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .