Lock an application in Linux

By Sweta Panigrahi | 01-03-2018 11:03 AM | 836 | 1


All of us need some privacy. For security purpose or some personal reason, we just don't want few application to be accessed by everyone. Especially when we are not around! One way of doing so is by not giving our PC to others, but it doesn't work all the times. The other option is more convenient. LOCK THE APPLICATION. Let's say you don't want someone to access nautilus (Default file manager in fedora) or Firefox(web browser), just lock the application so that it asks for root authentication when prompt to open.
* I am using Fedora 24 here, but it can be done in any Red Hat or Debian based OS.

We are going to change '.desktop' file of the particular application in order to lock it. Every application has its own '.desktop'f ile.

In GNOME, an application gets registered into the desktop's menu through a desktop entry, which is a text file with .desktop extension. This desktop file contains a listing of the configurations for your application.

.Desktop file is located in directory:  /usr/share/applications

We will change the permission using the same file.


How to do that?

1. Open the terminal and go to the directory mentioned above.


   $ cd /usr/share/applications
     
List of my .desktop files                    

2. Select the application that you want to lock. For example, I will lock Firefox.


Open firefox.desktop file using any text editor. As I am in love with vim, I will use the same.


$ sudo firefox.desktop

Text file 'firefox.desktop'

3. We are going to change Exec=firefox %u to Exec=gksudo -k -u root firefox %u

Here we are changing the file permission when executed.

So search Exec=firefox in the text file.

To search in vim, press ':' followed my a '/' and the characters that you want to search.

searching :/Exec=firefox %u  
 
Result
4. Now change it using Insert mode (i), to Exec=gksudo -k -u root firefox %u.

Cheers, we are done!
 

THIS BLOG POST IS A SMALL EXCERPT FROM VIPUL SIDDHARTH'S ACTUAL BLOG.


1
Facebook Google LinkedIn Pinterest Reddit Tumblr Twitter Email Print